This commit is contained in:
reya 2023-11-30 17:24:07 +07:00
parent 80f675cb54
commit 5318f6c4cb
31 changed files with 71 additions and 99 deletions

View File

@ -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"
}
}

View File

@ -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:

View File

@ -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 {

View File

@ -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() {

View File

@ -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';

View File

@ -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();

View File

@ -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;

View File

@ -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,

View File

@ -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;

View File

@ -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 (
<div className="aspect-square h-auto w-full animate-pulse rounded-lg bg-neutral-300 dark:bg-neutral-700" />
);
}
return (
<div className="flex flex-col gap-1 rounded-lg bg-neutral-100 p-1 ring-1 ring-transparent hover:bg-neutral-200 hover:ring-blue-500 dark:bg-neutral-900 dark:hover:bg-neutral-800">
<Link to="/settings/" className="relative inline-block">

View File

@ -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({

View File

@ -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 }) {

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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 }) {

View File

@ -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 }) {

View File

@ -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 }) {

View File

@ -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 }) {

View File

@ -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();

View File

@ -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';

View File

@ -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 }) {

View File

@ -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 = {

View File

@ -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() {

View File

@ -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';

View File

@ -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 }) {

View File

@ -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<OnboardingState>()(
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),
}
)
);

View File

@ -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,

View File

@ -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',