fixed build errors, again

This commit is contained in:
Ren Amamiya 2023-04-23 09:56:31 +07:00
parent 4b937c87ff
commit 2d9689967d
9 changed files with 32 additions and 30 deletions

View File

@ -38,8 +38,7 @@
"react-string-replace": "^1.1.0", "react-string-replace": "^1.1.0",
"react-virtuoso": "^4.2.2", "react-virtuoso": "^4.2.2",
"swr": "^2.1.3", "swr": "^2.1.3",
"tauri-plugin-sql-api": "github:tauri-apps/tauri-plugin-sql", "tauri-plugin-sql-api": "github:tauri-apps/tauri-plugin-sql"
"unique-names-generator": "^4.7.1"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/typography": "^0.5.9", "@tailwindcss/typography": "^0.5.9",

View File

@ -52,7 +52,6 @@ specifiers:
tailwindcss: ^3.3.1 tailwindcss: ^3.3.1
tauri-plugin-sql-api: github:tauri-apps/tauri-plugin-sql tauri-plugin-sql-api: github:tauri-apps/tauri-plugin-sql
typescript: ^4.9.5 typescript: ^4.9.5
unique-names-generator: ^4.7.1
vite: ^4.3.1 vite: ^4.3.1
vite-plugin-ssr: ^0.4.115 vite-plugin-ssr: ^0.4.115
vite-tsconfig-paths: ^4.2.0 vite-tsconfig-paths: ^4.2.0
@ -84,7 +83,6 @@ dependencies:
react-virtuoso: 4.2.2_biqbaboplfbrettd7655fr4n2y react-virtuoso: 4.2.2_biqbaboplfbrettd7655fr4n2y
swr: 2.1.3_react@18.2.0 swr: 2.1.3_react@18.2.0
tauri-plugin-sql-api: github.com/tauri-apps/tauri-plugin-sql/62b21ef24303d80e9905f57b2b6d27efc8677c23 tauri-plugin-sql-api: github.com/tauri-apps/tauri-plugin-sql/62b21ef24303d80e9905f57b2b6d27efc8677c23
unique-names-generator: 4.7.1
devDependencies: devDependencies:
'@tailwindcss/typography': 0.5.9_tailwindcss@3.3.1 '@tailwindcss/typography': 0.5.9_tailwindcss@3.3.1
@ -5086,12 +5084,6 @@ packages:
which-boxed-primitive: 1.0.2 which-boxed-primitive: 1.0.2
dev: true dev: true
/unique-names-generator/4.7.1:
resolution:
{ integrity: sha512-lMx9dX+KRmG8sq6gulYYpKWZc9RlGsgBR6aoO8Qsm3qvkSJ+3rAymr+TnV8EDMrIrwuFJ4kruzMWM/OpYzPoow== }
engines: { node: '>=8' }
dev: false
/update-browserslist-db/1.0.11_browserslist@4.21.5: /update-browserslist-db/1.0.11_browserslist@4.21.5:
resolution: resolution:
{ integrity: sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA== } { integrity: sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA== }

View File

@ -3,7 +3,7 @@
"beforeDevCommand": "pnpm dev", "beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm build", "beforeBuildCommand": "pnpm build",
"devPath": "http://localhost:3000", "devPath": "http://localhost:3000",
"distDir": "../dist", "distDir": "../dist/client",
"withGlobalTauri": true "withGlobalTauri": true
}, },
"package": { "package": {

View File

@ -3,7 +3,6 @@ import { ChannelListItem } from '@components/channels/channelListItem';
import { DEFAULT_CHANNELS } from '@stores/constants'; import { DEFAULT_CHANNELS } from '@stores/constants';
import { Plus } from 'iconoir-react'; import { Plus } from 'iconoir-react';
import Link from 'next/link';
import { useState } from 'react'; import { useState } from 'react';
export default function ChannelList() { export default function ChannelList() {
@ -14,9 +13,8 @@ export default function ChannelList() {
{list.map((item) => ( {list.map((item) => (
<ChannelListItem key={item.event_id} data={item} /> <ChannelListItem key={item.event_id} data={item} />
))} ))}
<Link <a
prefetch={false} href="/create-channel"
href="/nostr/create-channel"
className="group inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900" className="group inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900"
> >
<div className="inline-flex h-5 w-5 shrink items-center justify-center rounded bg-zinc-900 group-hover:bg-zinc-800"> <div className="inline-flex h-5 w-5 shrink items-center justify-center rounded bg-zinc-900 group-hover:bg-zinc-800">
@ -25,7 +23,7 @@ export default function ChannelList() {
<div> <div>
<h5 className="text-sm font-medium text-zinc-500 group-hover:text-zinc-400">Add a new channel</h5> <h5 className="text-sm font-medium text-zinc-500 group-hover:text-zinc-400">Add a new channel</h5>
</div> </div>
</Link> </a>
</div> </div>
); );
} }

View File

@ -1,5 +1,6 @@
import AppHeader from '@components/appHeader'; import AppHeader from '@components/appHeader';
import MultiAccounts from '@components/multiAccounts'; import MultiAccounts from '@components/multiAccounts';
import Navigation from '@components/navigation';
export default function NewsfeedLayout({ children }: { children: React.ReactNode }) { export default function NewsfeedLayout({ children }: { children: React.ReactNode }) {
return ( return (
@ -15,7 +16,22 @@ export default function NewsfeedLayout({ children }: { children: React.ReactNode
<div className="relative w-[68px] shrink-0 border-r border-zinc-900"> <div className="relative w-[68px] shrink-0 border-r border-zinc-900">
<MultiAccounts /> <MultiAccounts />
</div> </div>
{children} <div className="grid w-full grid-cols-4 xl:grid-cols-5">
<div className="scrollbar-hide col-span-1 overflow-y-auto overflow-x-hidden border-r border-zinc-900">
<Navigation />
</div>
<div className="col-span-3 m-3 overflow-hidden rounded-lg border border-zinc-800 bg-zinc-900 shadow-input shadow-black/20 xl:col-span-2 xl:mr-1.5">
<div className="h-full w-full rounded-lg">{children}</div>
</div>
<div className="col-span-3 m-3 hidden overflow-hidden rounded-lg border border-zinc-800 bg-zinc-900 shadow-input shadow-black/20 xl:col-span-2 xl:ml-1.5 xl:flex">
<div className="flex h-full w-full items-center justify-center">
<p className="select-text p-8 text-center text-zinc-400">
This feature hasn&apos;t implemented yet, so resize Lume to the initial size for a better experience.
I&apos;m sorry for this inconvenience, and I swear I will add it soon 😁
</p>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -8,6 +8,12 @@ export const RelayContext = createContext({});
const relays = DEFAULT_RELAYS; const relays = DEFAULT_RELAYS;
export default function RelayProvider({ children }: { children: React.ReactNode }) { export default function RelayProvider({ children }: { children: React.ReactNode }) {
const pool = useMemo(() => new RelayPool(relays, { useEventCache: false, logSubscriptions: false }), []); const pool = useMemo(() => {
if (typeof window !== 'undefined') {
return new RelayPool(relays, { useEventCache: false, logSubscriptions: false });
} else {
return null;
}
}, []);
return <RelayContext.Provider value={[pool, relays]}>{children}</RelayContext.Provider>; return <RelayContext.Provider value={[pool, relays]}>{children}</RelayContext.Provider>;
} }

View File

@ -18,7 +18,7 @@ import LumeSymbol from '@assets/icons/Lume';
import { writeStorage } from '@rehooks/local-storage'; import { writeStorage } from '@rehooks/local-storage';
import { useCallback, useContext, useEffect, useRef } from 'react'; import { useCallback, useContext, useEffect, useRef } from 'react';
import { navigate, prefetch } from 'vite-plugin-ssr/client/router'; import { navigate } from 'vite-plugin-ssr/client/router';
export function Page() { export function Page() {
const [pool, relays]: any = useContext(RelayContext); const [pool, relays]: any = useContext(RelayContext);
@ -123,7 +123,6 @@ export function Page() {
() => { () => {
updateLastLogin(dateToUnix(now.current)); updateLastLogin(dateToUnix(now.current));
timeout.current = setTimeout(() => { timeout.current = setTimeout(() => {
prefetch('/newsfeed/following');
navigate('/newsfeed/following'); navigate('/newsfeed/following');
}, 5000); }, 5000);
}, },
@ -153,7 +152,6 @@ export function Page() {
// fetch data // fetch data
fetchData(account, account.follows); fetchData(account, account.follows);
} else { } else {
prefetch('/onboarding');
navigate('/onboarding', { overwriteLastHistoryEntry: true }); navigate('/onboarding', { overwriteLastHistoryEntry: true });
} }
}) })

View File

@ -6,13 +6,8 @@ import { createAccount } from '@utils/storage';
import { EyeClose, EyeEmpty } from 'iconoir-react'; import { EyeClose, EyeEmpty } from 'iconoir-react';
import { generatePrivateKey, getEventHash, getPublicKey, nip19, signEvent } from 'nostr-tools'; import { generatePrivateKey, getEventHash, getPublicKey, nip19, signEvent } from 'nostr-tools';
import { useCallback, useContext, useMemo, useState } from 'react'; import { useCallback, useContext, useMemo, useState } from 'react';
import { Config, names, uniqueNamesGenerator } from 'unique-names-generator';
import { navigate } from 'vite-plugin-ssr/client/router'; import { navigate } from 'vite-plugin-ssr/client/router';
const config: Config = {
dictionaries: [names],
};
export function Page() { export function Page() {
const [pool, relays]: any = useContext(RelayContext); const [pool, relays]: any = useContext(RelayContext);
@ -20,7 +15,7 @@ export function Page() {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const privkey = useMemo(() => generatePrivateKey(), []); const privkey = useMemo(() => generatePrivateKey(), []);
const name = useMemo(() => uniqueNamesGenerator(config).toString(), []); const name = 'Pleb';
const pubkey = getPublicKey(privkey); const pubkey = getPublicKey(privkey);
const npub = nip19.npubEncode(pubkey); const npub = nip19.npubEncode(pubkey);

View File

@ -6,8 +6,6 @@ import viteTsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({ export default defineConfig({
plugins: [react(), ssr({ prerender: true }), viteTsconfigPaths()], plugins: [react(), ssr({ prerender: true }), viteTsconfigPaths()],
define: { define: {
global: { global: 'window',
window: {},
},
}, },
}); });