diff --git a/package.json b/package.json
index 7dfd73ec..dbdb86ff 100644
--- a/package.json
+++ b/package.json
@@ -120,6 +120,7 @@
"tailwindcss": "^3.3.5",
"typescript": "^5.3.2",
"vite": "^4.5.0",
+ "vite-plugin-top-level-await": "^1.3.1",
"vite-tsconfig-paths": "^4.2.1"
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 97297c70..959ea533 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -307,6 +307,9 @@ devDependencies:
vite:
specifier: ^4.5.0
version: 4.5.0(@types/node@20.10.1)
+ vite-plugin-top-level-await:
+ specifier: ^1.3.1
+ version: 1.3.1(vite@4.5.0)
vite-tsconfig-paths:
specifier: ^4.2.1
version: 4.2.1(typescript@5.3.2)(vite@4.5.0)
@@ -1893,6 +1896,16 @@ packages:
engines: {node: '>=14.0.0'}
dev: false
+ /@rollup/plugin-virtual@3.0.2:
+ resolution: {integrity: sha512-10monEYsBp3scM4/ND4LNH5Rxvh3e/cVeL3jWTgZ2SrQ+BmUoQcopVQvnaMcOnykb1VkxUFuDAN+0FnpTFRy2A==}
+ engines: {node: '>=14.0.0'}
+ peerDependencies:
+ rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
+ peerDependenciesMeta:
+ rollup:
+ optional: true
+ dev: true
+
/@scure/base@1.1.1:
resolution: {integrity: sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==}
dev: false
@@ -6222,6 +6235,11 @@ packages:
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
dev: true
+ /uuid@9.0.1:
+ resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==}
+ hasBin: true
+ dev: true
+
/virtua@0.16.7(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-n7fzGHm88lY+ZlYadqrWV/7uiwAxg58na1+LSnEnVZdVFH2EJVsF3QgAA9sP9J2/OeNhxHd6nhgVKNEslWSOMA==}
peerDependencies:
@@ -6232,6 +6250,20 @@ packages:
react-dom: 18.2.0(react@18.2.0)
dev: false
+ /vite-plugin-top-level-await@1.3.1(vite@4.5.0):
+ resolution: {integrity: sha512-55M1h4NAwkrpxPNOJIBzKZFihqLUzIgnElLSmPNPMR2Fn9+JHKaNg3sVX1Fq+VgvuBksQYxiD3OnwQAUu7kaPQ==}
+ peerDependencies:
+ vite: '>=2.8'
+ dependencies:
+ '@rollup/plugin-virtual': 3.0.2
+ '@swc/core': 1.3.99
+ uuid: 9.0.1
+ vite: 4.5.0(@types/node@20.10.1)
+ transitivePeerDependencies:
+ - '@swc/helpers'
+ - rollup
+ dev: true
+
/vite-tsconfig-paths@4.2.1(typescript@5.3.2)(vite@4.5.0):
resolution: {integrity: sha512-GNUI6ZgPqT3oervkvzU+qtys83+75N/OuDaQl7HmOqFTb0pjZsuARrRipsyJhJ3enqV8beI1xhGbToR4o78nSQ==}
peerDependencies:
diff --git a/src/app.css b/src/app.css
index cba4eba0..e6e16190 100644
--- a/src/app.css
+++ b/src/app.css
@@ -1,4 +1,4 @@
-@import 'reactflow/dist/style.css';
+/* @import 'reactflow/dist/style.css'; */
@tailwind base;
@tailwind components;
@@ -50,19 +50,15 @@ input::-ms-clear {
--video-brand: var(--brand-color);
--video-focus-ring-color: var(--focus-color);
--video-border-radius: 8px;
- width: 100%;
+ @apply w-full;
}
.player[data-view-type='video'] {
- aspect-ratio: 16 /9;
+ @apply aspect-video;
}
.ProseMirror p.is-empty::before {
- @apply text-neutral-600 dark:text-neutral-400;
- content: attr(data-placeholder);
- float: left;
- height: 0;
- pointer-events: none;
+ @apply text-neutral-600 dark:text-neutral-400 float-left h-0 pointer-events-none content-[attr(data-placeholder)];
}
.ProseMirror img.ProseMirror-selectednode {
diff --git a/src/app/home/index.tsx b/src/app/home/index.tsx
index 08facfae..fcca85ed 100644
--- a/src/app/home/index.tsx
+++ b/src/app/home/index.tsx
@@ -21,8 +21,7 @@ import {
WidgetList,
} from '@shared/widgets';
-import { WIDGET_KIND } from '@stores/constants';
-
+import { WIDGET_KIND } from '@utils/constants';
import { Widget } from '@utils/types';
export function HomeScreen() {
diff --git a/src/app/new/post.tsx b/src/app/new/post.tsx
index b3fc4bb6..68f36526 100644
--- a/src/app/new/post.tsx
+++ b/src/app/new/post.tsx
@@ -18,8 +18,7 @@ import { useNDK } from '@libs/ndk/provider';
import { CancelIcon, LoaderIcon } from '@shared/icons';
import { MentionNote } from '@shared/notes';
-import { WIDGET_KIND } from '@stores/constants';
-
+import { WIDGET_KIND } from '@utils/constants';
import { useSuggestion } from '@utils/hooks/useSuggestion';
import { useWidget } from '@utils/hooks/useWidget';
diff --git a/src/libs/ndk/instance.ts b/src/libs/ndk/instance.ts
index f762d7b4..ee9a0489 100644
--- a/src/libs/ndk/instance.ts
+++ b/src/libs/ndk/instance.ts
@@ -14,7 +14,7 @@ import { useEffect, useState } from 'react';
import NDKCacheAdapterTauri from '@libs/ndk/cache';
import { useStorage } from '@libs/storage/provider';
-import { FETCH_LIMIT } from '@stores/constants';
+import { FETCH_LIMIT } from '@utils/constants';
export const NDKInstance = () => {
const { db } = useStorage();
diff --git a/src/libs/ndk/provider.tsx b/src/libs/ndk/provider.tsx
index 9fbaff12..7ad2fe56 100644
--- a/src/libs/ndk/provider.tsx
+++ b/src/libs/ndk/provider.tsx
@@ -8,7 +8,7 @@ import { NDKInstance } from '@libs/ndk/instance';
import { LoaderIcon } from '@shared/icons';
-import { QUOTES } from '@stores/constants';
+import { QUOTES } from '@utils/constants';
interface NDKContext {
ndk: undefined | NDK;
diff --git a/src/libs/storage/instance.ts b/src/libs/storage/instance.ts
index 9b399135..ea62f700 100644
--- a/src/libs/storage/instance.ts
+++ b/src/libs/storage/instance.ts
@@ -3,8 +3,7 @@ import { invoke } from '@tauri-apps/api/primitives';
import { Platform } from '@tauri-apps/plugin-os';
import Database from '@tauri-apps/plugin-sql';
-import { FULL_RELAYS } from '@stores/constants';
-
+import { FULL_RELAYS } from '@utils/constants';
import { rawEvent } from '@utils/transform';
import type {
Account,
diff --git a/src/libs/storage/provider.tsx b/src/libs/storage/provider.tsx
index e28b3a50..a2bfa4ac 100644
--- a/src/libs/storage/provider.tsx
+++ b/src/libs/storage/provider.tsx
@@ -10,7 +10,7 @@ import { LumeStorage } from '@libs/storage/instance';
import { LoaderIcon } from '@shared/icons';
-import { QUOTES } from '@stores/constants';
+import { QUOTES } from '@utils/constants';
interface StorageContext {
db: LumeStorage;
diff --git a/src/shared/accounts/active.tsx b/src/shared/accounts/active.tsx
index 23d97d3a..e276f289 100644
--- a/src/shared/accounts/active.tsx
+++ b/src/shared/accounts/active.tsx
@@ -11,18 +11,12 @@ import { useProfile } from '@utils/hooks/useProfile';
export function ActiveAccount() {
const { db } = useStorage();
- const { status, user } = useProfile(db.account.pubkey);
+ const { user } = useProfile(db.account.pubkey);
const svgURI =
'data:image/svg+xml;utf8,' +
encodeURIComponent(minidenticon(db.account.pubkey, 90, 50));
- if (status === 'pending') {
- return (
-
- );
- }
-
return (
diff --git a/src/shared/notes/actions.tsx b/src/shared/notes/actions.tsx
index 0cb66591..120e9e92 100644
--- a/src/shared/notes/actions.tsx
+++ b/src/shared/notes/actions.tsx
@@ -7,8 +7,7 @@ import { NoteReaction } from '@shared/notes/actions/reaction';
import { NoteRepost } from '@shared/notes/actions/repost';
import { NoteZap } from '@shared/notes/actions/zap';
-import { WIDGET_KIND } from '@stores/constants';
-
+import { WIDGET_KIND } from '@utils/constants';
import { useWidget } from '@utils/hooks/useWidget';
export function NoteActions({
diff --git a/src/shared/notes/mentions/hashtag.tsx b/src/shared/notes/mentions/hashtag.tsx
index 801ceed2..74a0d265 100644
--- a/src/shared/notes/mentions/hashtag.tsx
+++ b/src/shared/notes/mentions/hashtag.tsx
@@ -1,5 +1,4 @@
-import { WIDGET_KIND } from '@stores/constants';
-
+import { WIDGET_KIND } from '@utils/constants';
import { useWidget } from '@utils/hooks/useWidget';
export function Hashtag({ tag }: { tag: string }) {
diff --git a/src/shared/notes/mentions/note.tsx b/src/shared/notes/mentions/note.tsx
index 07024a0f..cce5a106 100644
--- a/src/shared/notes/mentions/note.tsx
+++ b/src/shared/notes/mentions/note.tsx
@@ -9,8 +9,7 @@ import {
} from '@shared/notes';
import { User } from '@shared/user';
-import { WIDGET_KIND } from '@stores/constants';
-
+import { WIDGET_KIND } from '@utils/constants';
import { useEvent } from '@utils/hooks/useEvent';
import { useWidget } from '@utils/hooks/useWidget';
diff --git a/src/shared/notes/mentions/user.tsx b/src/shared/notes/mentions/user.tsx
index 1108560d..338c349b 100644
--- a/src/shared/notes/mentions/user.tsx
+++ b/src/shared/notes/mentions/user.tsx
@@ -1,7 +1,6 @@
import { memo } from 'react';
-import { WIDGET_KIND } from '@stores/constants';
-
+import { WIDGET_KIND } from '@utils/constants';
import { useProfile } from '@utils/hooks/useProfile';
import { useWidget } from '@utils/hooks/useWidget';
diff --git a/src/shared/notes/notify.tsx b/src/shared/notes/notify.tsx
index d5a2bf7a..d1156727 100644
--- a/src/shared/notes/notify.tsx
+++ b/src/shared/notes/notify.tsx
@@ -5,8 +5,7 @@ import { ReplyIcon, RepostIcon } from '@shared/icons';
import { ChildNote, TextKind } from '@shared/notes';
import { User } from '@shared/user';
-import { WIDGET_KIND } from '@stores/constants';
-
+import { WIDGET_KIND } from '@utils/constants';
import { formatCreatedAt } from '@utils/createdAt';
import { useNostr } from '@utils/hooks/useNostr';
import { useWidget } from '@utils/hooks/useWidget';
diff --git a/src/shared/notes/text.tsx b/src/shared/notes/text.tsx
index 68183e8d..c8540a48 100644
--- a/src/shared/notes/text.tsx
+++ b/src/shared/notes/text.tsx
@@ -4,8 +4,7 @@ import { memo } from 'react';
import { ChildNote, NoteActions } from '@shared/notes';
import { User } from '@shared/user';
-import { WIDGET_KIND } from '@stores/constants';
-
+import { WIDGET_KIND } from '@utils/constants';
import { useNostr } from '@utils/hooks/useNostr';
import { useRichContent } from '@utils/hooks/useRichContent';
import { useWidget } from '@utils/hooks/useWidget';
diff --git a/src/shared/widgets/article.tsx b/src/shared/widgets/article.tsx
index 7b5d17eb..7a29799b 100644
--- a/src/shared/widgets/article.tsx
+++ b/src/shared/widgets/article.tsx
@@ -12,8 +12,7 @@ import { MemoizedArticleNote } from '@shared/notes';
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
-import { FETCH_LIMIT } from '@stores/constants';
-
+import { FETCH_LIMIT } from '@utils/constants';
import { Widget } from '@utils/types';
export function ArticleWidget({ widget }: { widget: Widget }) {
diff --git a/src/shared/widgets/file.tsx b/src/shared/widgets/file.tsx
index fbf8dea7..2fe07523 100644
--- a/src/shared/widgets/file.tsx
+++ b/src/shared/widgets/file.tsx
@@ -12,8 +12,7 @@ import { MemoizedFileNote } from '@shared/notes';
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
-import { FETCH_LIMIT } from '@stores/constants';
-
+import { FETCH_LIMIT } from '@utils/constants';
import { Widget } from '@utils/types';
export function FileWidget({ widget }: { widget: Widget }) {
diff --git a/src/shared/widgets/group.tsx b/src/shared/widgets/group.tsx
index bdc9cf0e..41be9b0c 100644
--- a/src/shared/widgets/group.tsx
+++ b/src/shared/widgets/group.tsx
@@ -15,8 +15,7 @@ import {
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
-import { FETCH_LIMIT } from '@stores/constants';
-
+import { FETCH_LIMIT } from '@utils/constants';
import { Widget } from '@utils/types';
export function GroupWidget({ widget }: { widget: Widget }) {
diff --git a/src/shared/widgets/hashtag.tsx b/src/shared/widgets/hashtag.tsx
index cb9e8d9c..178de71f 100644
--- a/src/shared/widgets/hashtag.tsx
+++ b/src/shared/widgets/hashtag.tsx
@@ -10,8 +10,7 @@ import { MemoizedRepost, MemoizedTextNote, UnknownNote } from '@shared/notes';
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
-import { FETCH_LIMIT } from '@stores/constants';
-
+import { FETCH_LIMIT } from '@utils/constants';
import { Widget } from '@utils/types';
export function HashtagWidget({ widget }: { widget: Widget }) {
diff --git a/src/shared/widgets/newsfeed.tsx b/src/shared/widgets/newsfeed.tsx
index 8bbe3c0e..b2e8bf16 100644
--- a/src/shared/widgets/newsfeed.tsx
+++ b/src/shared/widgets/newsfeed.tsx
@@ -16,7 +16,7 @@ import {
import { TitleBar } from '@shared/titleBar';
import { LiveUpdater, WidgetWrapper } from '@shared/widgets';
-import { FETCH_LIMIT } from '@stores/constants';
+import { FETCH_LIMIT } from '@utils/constants';
export function NewsfeedWidget() {
const { db } = useStorage();
diff --git a/src/shared/widgets/notification.tsx b/src/shared/widgets/notification.tsx
index 9c7815fd..e56934d9 100644
--- a/src/shared/widgets/notification.tsx
+++ b/src/shared/widgets/notification.tsx
@@ -11,8 +11,7 @@ import { MemoizedNotifyNote, NoteSkeleton } from '@shared/notes';
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
-import { FETCH_LIMIT } from '@stores/constants';
-
+import { FETCH_LIMIT } from '@utils/constants';
import { useNostr } from '@utils/hooks/useNostr';
import { sendNativeNotification } from '@utils/notification';
diff --git a/src/shared/widgets/other/addGroupFeeds.tsx b/src/shared/widgets/other/addGroupFeeds.tsx
index c85596eb..4d2f9b9c 100644
--- a/src/shared/widgets/other/addGroupFeeds.tsx
+++ b/src/shared/widgets/other/addGroupFeeds.tsx
@@ -12,8 +12,7 @@ import {
} from '@shared/icons';
import { User } from '@shared/user';
-import { WIDGET_KIND } from '@stores/constants';
-
+import { WIDGET_KIND } from '@utils/constants';
import { useWidget } from '@utils/hooks/useWidget';
export function AddGroupFeeds({ currentWidgetId }: { currentWidgetId: string }) {
diff --git a/src/shared/widgets/other/addHashtagFeeds.tsx b/src/shared/widgets/other/addHashtagFeeds.tsx
index c815ace7..d9b5e1b5 100644
--- a/src/shared/widgets/other/addHashtagFeeds.tsx
+++ b/src/shared/widgets/other/addHashtagFeeds.tsx
@@ -3,8 +3,7 @@ import { Resolver, useForm } from 'react-hook-form';
import { CancelIcon, GroupFeedsIcon, PlusIcon } from '@shared/icons';
-import { HASHTAGS, WIDGET_KIND } from '@stores/constants';
-
+import { HASHTAGS, WIDGET_KIND } from '@utils/constants';
import { useWidget } from '@utils/hooks/useWidget';
type FormValues = {
diff --git a/src/shared/widgets/other/toggleWidgetList.tsx b/src/shared/widgets/other/toggleWidgetList.tsx
index 6d7b9932..9a94ec53 100644
--- a/src/shared/widgets/other/toggleWidgetList.tsx
+++ b/src/shared/widgets/other/toggleWidgetList.tsx
@@ -1,8 +1,7 @@
import { PlusIcon } from '@shared/icons';
import { WidgetWrapper } from '@shared/widgets';
-import { WIDGET_KIND } from '@stores/constants';
-
+import { WIDGET_KIND } from '@utils/constants';
import { useWidget } from '@utils/hooks/useWidget';
export function ToggleWidgetList() {
diff --git a/src/shared/widgets/other/widgetList.tsx b/src/shared/widgets/other/widgetList.tsx
index 39085879..04b25b3b 100644
--- a/src/shared/widgets/other/widgetList.tsx
+++ b/src/shared/widgets/other/widgetList.tsx
@@ -2,8 +2,7 @@ import { ArticleIcon, MediaIcon, PlusIcon } from '@shared/icons';
import { TitleBar } from '@shared/titleBar';
import { AddGroupFeeds, AddHashtagFeeds, WidgetWrapper } from '@shared/widgets';
-import { TOPICS, WIDGET_KIND } from '@stores/constants';
-
+import { TOPICS, WIDGET_KIND } from '@utils/constants';
import { useWidget } from '@utils/hooks/useWidget';
import { Widget } from '@utils/types';
diff --git a/src/shared/widgets/topic.tsx b/src/shared/widgets/topic.tsx
index d910fc2d..d9de537b 100644
--- a/src/shared/widgets/topic.tsx
+++ b/src/shared/widgets/topic.tsx
@@ -16,8 +16,7 @@ import {
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
-import { FETCH_LIMIT } from '@stores/constants';
-
+import { FETCH_LIMIT } from '@utils/constants';
import { Widget } from '@utils/types';
export function TopicWidget({ widget }: { widget: Widget }) {
diff --git a/src/stores/onboarding.ts b/src/stores/onboarding.ts
deleted file mode 100644
index 97863439..00000000
--- a/src/stores/onboarding.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import { create } from 'zustand';
-import { createJSONStorage, persist } from 'zustand/middleware';
-
-interface OnboardingState {
- enrich: boolean;
- hashtag: boolean;
- circle: boolean;
- relays: boolean;
- outbox: boolean;
- notification: boolean;
- toggleEnrich: () => void;
- toggleHashtag: () => void;
- toggleCircle: () => void;
- toggleRelays: () => void;
- toggleOutbox: () => void;
- toggleNotification: () => void;
-}
-
-export const useOnboarding = create()(
- persist(
- (set) => ({
- enrich: false,
- hashtag: false,
- circle: false,
- relays: false,
- outbox: false,
- notification: false,
- toggleEnrich: () => set((state) => ({ enrich: !state.enrich })),
- toggleHashtag: () => set((state) => ({ hashtag: !state.hashtag })),
- toggleCircle: () => set((state) => ({ circle: !state.circle })),
- toggleRelays: () => set((state) => ({ relays: !state.relays })),
- toggleOutbox: () => set((state) => ({ outbox: !state.outbox })),
- toggleNotification: () => set((state) => ({ notification: !state.notification })),
- }),
- {
- name: 'onboarding',
- storage: createJSONStorage(() => sessionStorage),
- }
- )
-);
diff --git a/src/stores/constants.ts b/src/utils/constants.ts
similarity index 100%
rename from src/stores/constants.ts
rename to src/utils/constants.ts
diff --git a/src/utils/hooks/useProfile.ts b/src/utils/hooks/useProfile.ts
index aa448dad..918b2ec1 100644
--- a/src/utils/hooks/useProfile.ts
+++ b/src/utils/hooks/useProfile.ts
@@ -38,7 +38,7 @@ export function useProfile(pubkey: string, embed?: string) {
);
return profile;
},
- initialData: () => queryClient.getQueryData(['user', pubkey]),
+ initialData: () => queryClient.getQueryData(['user', pubkey]) as NDKUserProfile,
refetchOnWindowFocus: false,
refetchOnReconnect: false,
retry: 2,
diff --git a/vite.config.ts b/vite.config.ts
index 94e36316..640e7286 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,9 +1,17 @@
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
+import topLevelAwait from 'vite-plugin-top-level-await';
import viteTsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({
- plugins: [react(), viteTsconfigPaths()],
+ plugins: [
+ react(),
+ viteTsconfigPaths(),
+ topLevelAwait({
+ promiseExportName: '__tla',
+ promiseImportName: (i) => `__tla_${i}`,
+ }),
+ ],
envPrefix: ['VITE_', 'TAURI_'],
build: {
target: process.env.TAURI_PLATFORM === 'windows' ? 'chrome105' : 'safari13',