diff --git a/index.html b/index.html index 6941671a..7e1a22db 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Lume - +
diff --git a/package.json b/package.json index 8454c1cc..c532d4d1 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "tailwind-scrollbar": "^3.0.5", "tauri-controls": "^0.2.0", "tippy.js": "^6.3.7", - "virtua": "0.9.1", + "virtua": "^0.13.0", "zustand": "^4.4.3" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b509ee9e..0386bc75 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -186,8 +186,8 @@ dependencies: specifier: ^6.3.7 version: 6.3.7 virtua: - specifier: 0.9.1 - version: 0.9.1(react-dom@18.2.0)(react@18.2.0) + specifier: ^0.13.0 + version: 0.13.0(react-dom@18.2.0)(react@18.2.0) zustand: specifier: ^4.4.3 version: 4.4.3(@types/react@18.2.28)(react@18.2.0) @@ -6660,8 +6660,8 @@ packages: vfile-message: 3.1.4 dev: false - /virtua@0.9.1(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-uaFvh+5zCDEenQDgxfIs67kpci7d/3XjdnWP/TdDYLcoXdWKr5ddwiP1g+wybHpXmLqbfJ0X0njmlAvP7GwMdw==} + /virtua@0.13.0(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-NiM+3lhl/XMLWsT+Fc+rcMQrsAe7PDRvncu6CjP5UEgDtulIo05KAaugrJAr/ptBofP/iAnlZK/X0Bjd+UkjIQ==} peerDependencies: react: '>=16.14.0' react-dom: '>=16.14.0' diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index cf654473..cd5e9525 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -81,16 +81,6 @@ async fn opengraph(url: String) -> OpenGraphResponse { return result; } -#[tauri::command] -fn close_splashscreen(window: tauri::Window) { - // Close splashscreen - if let Some(splashscreen) = window.get_window("splashscreen") { - splashscreen.close().unwrap(); - } - // Show main window - window.get_window("main").unwrap().show().unwrap(); -} - #[tauri::command] fn secure_save(key: String, value: String) -> Result<(), ()> { let entry = Entry::new("lume", &key).expect("Failed to create entry"); @@ -252,7 +242,6 @@ fn main() { .plugin(tauri_plugin_upload::init()) .plugin(tauri_plugin_store::Builder::default().build()) .invoke_handler(tauri::generate_handler![ - close_splashscreen, opengraph, secure_save, secure_load diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json index 7f452e3a..c2bb213f 100644 --- a/src-tauri/tauri.linux.conf.json +++ b/src-tauri/tauri.linux.conf.json @@ -2,16 +2,6 @@ "$schema": "../node_modules/@tauri-apps/cli/schema.json", "tauri": { "windows": [ - { - "width": 300, - "height": 300, - "decorations": false, - "title": "Lume", - "center": true, - "resizable": false, - "label": "splashscreen", - "url": "splashscreen" - }, { "width": 1080, "height": 800, @@ -22,7 +12,6 @@ "center": true, "fullscreen": false, "hiddenTitle": true, - "visible": false, "fileDropEnabled": true, "decorations": false, "transparent": false diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json index 33809dcc..e2918d60 100644 --- a/src-tauri/tauri.macos.conf.json +++ b/src-tauri/tauri.macos.conf.json @@ -2,18 +2,6 @@ "$schema": "../node_modules/@tauri-apps/cli/schema.json", "tauri": { "windows": [ - { - "width": 300, - "height": 300, - "decorations": true, - "title": "Lume", - "titleBarStyle": "Overlay", - "hiddenTitle": true, - "center": true, - "resizable": false, - "label": "splashscreen", - "url": "splashscreen" - }, { "width": 1080, "height": 800, @@ -25,7 +13,6 @@ "center": true, "fullscreen": false, "hiddenTitle": true, - "visible": false, "fileDropEnabled": true, "decorations": true, "transparent": true, diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json index ce9c7bc3..daabd37a 100644 --- a/src-tauri/tauri.windows.conf.json +++ b/src-tauri/tauri.windows.conf.json @@ -2,16 +2,6 @@ "$schema": "../node_modules/@tauri-apps/cli/schema.json", "tauri": { "windows": [ - { - "width": 300, - "height": 300, - "decorations": false, - "title": "Lume", - "center": true, - "resizable": false, - "label": "splashscreen", - "url": "splashscreen" - }, { "width": 1080, "height": 800, @@ -22,7 +12,6 @@ "center": true, "fullscreen": false, "hiddenTitle": true, - "visible": false, "fileDropEnabled": true, "decorations": false, "transparent": true, diff --git a/src/app.tsx b/src/app.tsx index b6a3ed22..d6984047 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -156,14 +156,6 @@ export default function App() { }, ], }, - { - path: '/splashscreen', - errorElement: , - async lazy() { - const { SplashScreen } = await import('@app/splash'); - return { Component: SplashScreen }; - }, - }, { path: '/auth', element: , diff --git a/src/app/chats/index.tsx b/src/app/chats/index.tsx index 9aadca76..045900da 100644 --- a/src/app/chats/index.tsx +++ b/src/app/chats/index.tsx @@ -38,7 +38,7 @@ export function ChatsScreen() { data-tauri-drag-region className="flex h-11 w-full shrink-0 items-center border-b border-white/5 px-3" > -

+

All chats

@@ -46,8 +46,10 @@ export function ChatsScreen() { {status === 'loading' ? (
- -
Loading messages...
+ +
+ Loading messages... +
) : ( diff --git a/src/app/space/components/toggle.tsx b/src/app/space/components/toggle.tsx index 7710ad3f..931de796 100644 --- a/src/app/space/components/toggle.tsx +++ b/src/app/space/components/toggle.tsx @@ -21,7 +21,7 @@ export function ToggleWidgetList() { } className="inline-flex h-9 items-center gap-2 rounded-full bg-neutral-200 px-3 text-neutral-900 hover:bg-neutral-300 dark:bg-neutral-800 dark:text-neutral-100 dark:hover:bg-neutral-700" > - +

Add widget

diff --git a/src/app/space/components/widgetList.tsx b/src/app/space/components/widgetList.tsx index 3afdc001..c04a930b 100644 --- a/src/app/space/components/widgetList.tsx +++ b/src/app/space/components/widgetList.tsx @@ -96,10 +96,10 @@ export function WidgetList({ params }: { params: Widget }) { )}
-
+
{item.title}
-

+

{item.description}

@@ -128,7 +128,7 @@ export function WidgetList({ params }: { params: Widget }) { > Build your own widget{' '}
- + Coming soon
diff --git a/src/app/space/index.tsx b/src/app/space/index.tsx index 0493eefd..6e3520b3 100644 --- a/src/app/space/index.tsx +++ b/src/app/space/index.tsx @@ -1,5 +1,5 @@ import { useCallback, useEffect } from 'react'; -import { VList, WVList } from 'virtua'; +import { VList } from 'virtua'; import { ToggleWidgetList } from '@app/space/components/toggle'; import { WidgetList } from '@app/space/components/widgetList'; @@ -85,7 +85,10 @@ export function SpaceScreen() { }, [fetchWidgets]); return ( - + {!widgets ? (
diff --git a/src/app/splash.tsx b/src/app/splash.tsx deleted file mode 100644 index df9ed2de..00000000 --- a/src/app/splash.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { invoke } from '@tauri-apps/api'; -import { message } from '@tauri-apps/plugin-dialog'; -import { useEffect } from 'react'; - -import { useNDK } from '@libs/ndk/provider'; -import { useStorage } from '@libs/storage/provider'; - -import { LoaderIcon } from '@shared/icons'; - -import { useNostr } from '@utils/hooks/useNostr'; - -export function SplashScreen() { - const { db } = useStorage(); - const { ndk } = useNDK(); - const { fetchUserData } = useNostr(); - - useEffect(() => { - async function syncUserData() { - if (!db.account) { - await invoke('close_splashscreen'); - } else { - const onboarding = localStorage.getItem('onboarding'); - const step = JSON.parse(onboarding).state.step || null; - - if (step) { - await invoke('close_splashscreen'); - } else { - try { - const userData = await fetchUserData(); - if (userData.status === 'ok') { - // update last login = current time - await db.updateLastLogin(); - // close splash screen and open main app screen - await invoke('close_splashscreen'); - } - } catch (e) { - await message(e, { - title: 'An unexpected error has occurred', - type: 'error', - }); - await invoke('close_splashscreen'); - } - } - } - } - - if (ndk) { - syncUserData(); - } - }, [ndk, db.account]); - - return ( -
-
- -

- {!ndk ? 'Connecting...' : 'Syncing...'} -

-
-
- ); -} diff --git a/src/libs/ndk/instance.ts b/src/libs/ndk/instance.ts index b92aa21c..0a07e0a6 100644 --- a/src/libs/ndk/instance.ts +++ b/src/libs/ndk/instance.ts @@ -61,7 +61,7 @@ export const NDKInstance = () => { }); try { - await instance.connect(10000); + await instance.connect(); } catch (error) { await message(`NDK instance init failed: ${error}`, { title: 'Lume', diff --git a/src/libs/ndk/provider.tsx b/src/libs/ndk/provider.tsx index 44a5a04e..5b58e4f6 100644 --- a/src/libs/ndk/provider.tsx +++ b/src/libs/ndk/provider.tsx @@ -5,6 +5,8 @@ import { PropsWithChildren, createContext, useContext } from 'react'; import { NDKInstance } from '@libs/ndk/instance'; +import { LoaderIcon } from '@shared/icons'; + interface NDKContext { ndk: undefined | NDK; relayUrls: string[]; @@ -20,6 +22,22 @@ const NDKContext = createContext({ const NDKProvider = ({ children }: PropsWithChildren) => { const { ndk, relayUrls, fetcher } = NDKInstance(); + if (!ndk) { + return ( +
+
+ +

+ Connecting... +

+
+
+ ); + } + return ( diff --git a/src/shared/layouts/app.tsx b/src/shared/layouts/app.tsx index 6d89cc3c..c5c69768 100644 --- a/src/shared/layouts/app.tsx +++ b/src/shared/layouts/app.tsx @@ -11,26 +11,24 @@ export function AppLayout() { return (
- {db.platform !== 'macos' ? :
} + {db.platform !== 'macos' ? ( + + ) : ( +
+ )}
-
-
- - { - return location.pathname; - }} - /> -
+
+ +
diff --git a/src/shared/navigation.tsx b/src/shared/navigation.tsx index 0a22edd5..992fdaff 100644 --- a/src/shared/navigation.tsx +++ b/src/shared/navigation.tsx @@ -126,7 +126,7 @@ export function Navigation() { diff --git a/src/shared/notes/child.tsx b/src/shared/notes/child.tsx index ab1084eb..5976bed5 100644 --- a/src/shared/notes/child.tsx +++ b/src/shared/notes/child.tsx @@ -56,7 +56,7 @@ export function ChildNote({ id, root }: { id: string; root?: string }) { Lume (System)
-
+
@@ -81,7 +81,7 @@ export function ChildNote({ id, root }: { id: string; root?: string }) {
-
+
{renderKind(data)} diff --git a/src/shared/notes/kinds/repost.tsx b/src/shared/notes/kinds/repost.tsx index 592ee6fd..88eadf18 100644 --- a/src/shared/notes/kinds/repost.tsx +++ b/src/shared/notes/kinds/repost.tsx @@ -71,7 +71,7 @@ export function Repost({
-
+
{renderKind(embedEvent)} @@ -116,7 +116,7 @@ export function Repost({ Lume (System)
-
+
@@ -148,7 +148,7 @@ export function Repost({
-
+
{renderKind(data)} diff --git a/src/shared/notes/kinds/text.tsx b/src/shared/notes/kinds/text.tsx index 1a5c5a8a..325a5eb6 100644 --- a/src/shared/notes/kinds/text.tsx +++ b/src/shared/notes/kinds/text.tsx @@ -23,7 +23,7 @@ export function TextNote(props: { content?: string }) { return (
{ diff --git a/src/shared/notes/mentions/note.tsx b/src/shared/notes/mentions/note.tsx index baaa76d1..ed3a8379 100644 --- a/src/shared/notes/mentions/note.tsx +++ b/src/shared/notes/mentions/note.tsx @@ -58,8 +58,8 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) { if (status === 'error') { const noteLink = `https://njump.me/${nip19.noteEncode(id)}`; return ( -
-
+
+
lume
@@ -67,7 +67,7 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) { Lume (System)
-
+
Lume cannot find this post with your current relays, but you can view it via njump.me.{' '} @@ -87,10 +87,10 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) { onKeyDown={(e) => openThread(e, id)} role="button" tabIndex={0} - className="mt-3 cursor-default rounded-lg bg-white/10 px-3 py-3 backdrop-blur-xl" + className="mt-3 cursor-default rounded-lg bg-neutral-200 px-3 py-3 dark:bg-neutral-800" > -
{renderKind(data)}
+
{renderKind(data)}
); }); diff --git a/src/shared/notes/preview/link.tsx b/src/shared/notes/preview/link.tsx index 53a59190..e9222d01 100644 --- a/src/shared/notes/preview/link.tsx +++ b/src/shared/notes/preview/link.tsx @@ -49,11 +49,11 @@ export function LinkPreview({ urls }: { urls: string[] }) { {data.title} {data.description && ( -

+

{data.description}

)} - + {domain.hostname}
diff --git a/src/shared/notes/wrapper.tsx b/src/shared/notes/wrapper.tsx index 8f6d5b15..b3e3cae7 100644 --- a/src/shared/notes/wrapper.tsx +++ b/src/shared/notes/wrapper.tsx @@ -31,7 +31,7 @@ export function NoteWrapper({
{reply && }
-
+
{cloneElement( diff --git a/src/utils/hooks/useNostr.ts b/src/utils/hooks/useNostr.ts index 6acc00d3..c9fb1ff7 100644 --- a/src/utils/hooks/useNostr.ts +++ b/src/utils/hooks/useNostr.ts @@ -38,7 +38,6 @@ export function useNostr() { callback: (event: NDKEvent) => void, groupable?: boolean ) => { - console.info(ndk); if (!ndk) throw new Error('NDK instance not found'); const subEvent = ndk.subscribe(filter, {