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

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,