Added Note Sharing Links
This commit is contained in:
+56
-46
@@ -92,53 +92,63 @@ const App: Component = () => {
|
||||
return view;
|
||||
};
|
||||
|
||||
return (
|
||||
<Show
|
||||
when={isEmbed()}
|
||||
fallback={
|
||||
<Show when={isAuthenticated()} fallback={<AuthCallback onSuccess={() => { }} />}>
|
||||
<Layout currentView={currentView()} setView={setCurrentView}>
|
||||
<Suspense fallback={<div class="flex items-center justify-center h-full"><div class="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div></div>}>
|
||||
<Show when={currentView() === "critical"}><CriticalView /></Show>
|
||||
<Show when={currentView() === "urgency"}><UrgencyView /></Show>
|
||||
<Show when={currentView() === "priority"}><PriorityView /></Show>
|
||||
<Show when={currentView() === "matrix"}><MatrixView /></Show>
|
||||
<Show when={currentView() === "snowball"}><SnowballView /></Show>
|
||||
<Show when={currentView() === "dig_in"}><DigInView /></Show>
|
||||
<Show when={currentView() === "progress"}><ProgressView /></Show>
|
||||
<Show when={currentView() === "settings"}><SettingsView setView={setCurrentView} /></Show>
|
||||
<Show when={currentView() === "help"}><HelpView onBack={() => setCurrentView("settings")} /></Show>
|
||||
</Suspense>
|
||||
</Layout>
|
||||
return (
|
||||
<Show
|
||||
when={isEmbed()}
|
||||
fallback={
|
||||
<Show when={isAuthenticated()} fallback={<AuthCallback onSuccess={() => { }} />}>
|
||||
<Layout currentView={currentView()} setView={setCurrentView}>
|
||||
<Suspense fallback={<div class="flex items-center justify-center h-full"><div class="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div></div>}>
|
||||
<Show when={currentView() === "critical"}><CriticalView /></Show>
|
||||
<Show when={currentView() === "urgency"}><UrgencyView /></Show>
|
||||
<Show when={currentView() === "priority"}><PriorityView /></Show>
|
||||
<Show when={currentView() === "matrix"}><MatrixView /></Show>
|
||||
<Show when={currentView() === "snowball"}><SnowballView /></Show>
|
||||
<Show when={currentView() === "dig_in"}><DigInView /></Show>
|
||||
<Show when={currentView() === "progress"}><ProgressView /></Show>
|
||||
<Show when={currentView() === "settings"}><SettingsView setView={setCurrentView} /></Show>
|
||||
<Show when={currentView() === "help"}><HelpView onBack={() => setCurrentView("settings")} /></Show>
|
||||
</Suspense>
|
||||
</Layout>
|
||||
</Show>
|
||||
}
|
||||
>
|
||||
{(() => {
|
||||
const isPublicNote = () => {
|
||||
const view = getEmbedView();
|
||||
const urlObj = new URL(location());
|
||||
const noteId = new URLSearchParams(urlObj.search).get('noteId') ||
|
||||
(urlObj.hash.includes('?') ? new URLSearchParams(urlObj.hash.substring(urlObj.hash.indexOf('?'))).get('noteId') : null);
|
||||
return view === 'embed_notes' && !!noteId;
|
||||
};
|
||||
|
||||
return (
|
||||
<EmbedAuthWrapper skipAuth={isPublicNote()}>
|
||||
<EmbedLayout>
|
||||
<Suspense fallback={<div class="flex items-center justify-center h-full"><div class="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div></div>}>
|
||||
<Show when={getEmbedView() === 'embed_notes'}>
|
||||
{(() => {
|
||||
const noteIdFromUrl = createMemo(() => {
|
||||
const urlObj = new URL(location());
|
||||
let noteId = new URLSearchParams(urlObj.search).get('noteId');
|
||||
if (!noteId && urlObj.hash.includes('?')) {
|
||||
const hashQueryString = urlObj.hash.substring(urlObj.hash.indexOf('?'));
|
||||
noteId = new URLSearchParams(hashQueryString).get('noteId');
|
||||
}
|
||||
return noteId;
|
||||
});
|
||||
return <NotepadView selectedNoteId={noteIdFromUrl()} setSelectedNoteId={() => { }} hideNavigation={!!noteIdFromUrl()} />;
|
||||
})()}
|
||||
</Show>
|
||||
<Show when={getEmbedView() === 'embed_quick_add'}>
|
||||
<QuickEntryForm autoFocus={true} />
|
||||
</Show>
|
||||
</Suspense>
|
||||
</EmbedLayout>
|
||||
</EmbedAuthWrapper>
|
||||
);
|
||||
})()}
|
||||
</Show>
|
||||
}
|
||||
>
|
||||
<EmbedAuthWrapper>
|
||||
<EmbedLayout>
|
||||
<Suspense fallback={<div class="flex items-center justify-center h-full"><div class="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div></div>}>
|
||||
<Show when={getEmbedView() === 'embed_notes'}>
|
||||
{(() => {
|
||||
const noteIdFromUrl = createMemo(() => {
|
||||
const urlObj = new URL(location());
|
||||
let noteId = new URLSearchParams(urlObj.search).get('noteId');
|
||||
// Production likely uses hash routing, so check hash for query params too
|
||||
if (!noteId && urlObj.hash.includes('?')) {
|
||||
const hashQueryString = urlObj.hash.substring(urlObj.hash.indexOf('?'));
|
||||
noteId = new URLSearchParams(hashQueryString).get('noteId');
|
||||
}
|
||||
return noteId;
|
||||
});
|
||||
console.log('[DEBUG App] Rendering embed/notes context. noteId trace:', noteIdFromUrl());
|
||||
return <NotepadView selectedNoteId={noteIdFromUrl()} setSelectedNoteId={() => { }} hideNavigation={!!noteIdFromUrl()} />;
|
||||
})()}
|
||||
</Show>
|
||||
<Show when={getEmbedView() === 'embed_quick_add'}>
|
||||
<QuickEntryForm autoFocus={true} />
|
||||
</Show>
|
||||
</Suspense>
|
||||
</EmbedLayout>
|
||||
</EmbedAuthWrapper>
|
||||
</Show>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user