fix(cordn): share public invite URL from the native app
This commit is contained in:
parent
ac5ac85004
commit
7881bbc50f
1 changed files with 8 additions and 4 deletions
|
|
@ -38,6 +38,7 @@ import { useCurrentUser } from '@/hooks/useCurrentUser';
|
|||
import { useUploadFile } from '@/hooks/useUploadFile';
|
||||
import { useCordnNative } from '@/hooks/useCordnNative';
|
||||
import { shortNpub } from '@/lib/coordinator';
|
||||
import { isNativePlatform } from '@/lib/platform';
|
||||
import { formatDistanceToNow } from '@/lib/dateFnsI18n';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { SkateCrew } from '@/lib/types';
|
||||
|
|
@ -83,10 +84,13 @@ export function CordnNativePanel({ crew, canManage, isMember }: CordnNativePanel
|
|||
const loadedRequestsRef = useRef(false);
|
||||
const { mutateAsync: uploadFile, isPending: uploading } = useUploadFile();
|
||||
|
||||
const inviteUrl = useMemo(
|
||||
() => `${window.location.origin}/#/crew/${crew.pubkey}/${crew.identifier}?tab=mls`,
|
||||
[crew.pubkey, crew.identifier],
|
||||
);
|
||||
const inviteUrl = useMemo(() => {
|
||||
// In the Android/iOS shell the page origin is `https://localhost`, which is
|
||||
// useless in a QR code. Share the public site there; keep the live origin on
|
||||
// the web (including previews).
|
||||
const origin = isNativePlatform() ? 'https://skate-spots.org' : window.location.origin;
|
||||
return `${origin}/#/crew/${crew.pubkey}/${crew.identifier}?tab=mls`;
|
||||
}, [crew.pubkey, crew.identifier]);
|
||||
|
||||
useEffect(() => {
|
||||
scrollRef.current?.scrollTo({ top: scrollRef.current.scrollHeight });
|
||||
|
|
|
|||
Loading…
Reference in a new issue