-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
55 changed files
with
869 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,9 @@ | ||
import { useEffect, useState } from "react"; | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
import { httpBatchLink } from "@trpc/client"; | ||
import superjson from "superjson"; | ||
import { TRPCProvider } from "@hoarder/shared-react/providers/trpc-provider"; | ||
|
||
import usePluginSettings, { getPluginSettings } from "./settings"; | ||
import { api } from "./trpc"; | ||
|
||
function getTRPCClient(address: string) { | ||
return api.createClient({ | ||
links: [ | ||
httpBatchLink({ | ||
url: `${address}/api/trpc`, | ||
async headers() { | ||
const settings = await getPluginSettings(); | ||
return { | ||
Authorization: `Bearer ${settings.apiKey}`, | ||
}; | ||
}, | ||
transformer: superjson, | ||
}), | ||
], | ||
}); | ||
} | ||
import usePluginSettings from "./settings"; | ||
|
||
export function Providers({ children }: { children: React.ReactNode }) { | ||
const { settings } = usePluginSettings(); | ||
const [queryClient] = useState(() => new QueryClient()); | ||
|
||
const [trpcClient, setTrpcClient] = useState< | ||
ReturnType<typeof getTRPCClient> | ||
>(getTRPCClient(settings.address)); | ||
|
||
useEffect(() => { | ||
setTrpcClient(getTRPCClient(settings.address)); | ||
}, [settings.address]); | ||
|
||
return ( | ||
<api.Provider | ||
key={settings.address} | ||
client={trpcClient} | ||
queryClient={queryClient} | ||
> | ||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider> | ||
</api.Provider> | ||
); | ||
return <TRPCProvider settings={settings}>{children}</TRPCProvider>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
import React from "react"; | ||
import Bookmarks from "@/components/dashboard/bookmarks/Bookmarks"; | ||
import TopNav from "@/components/dashboard/bookmarks/TopNav"; | ||
import UploadDropzone from "@/components/dashboard/UploadDropzone"; | ||
import { Separator } from "@/components/ui/separator"; | ||
|
||
export default async function BookmarksPage() { | ||
return ( | ||
<div> | ||
<UploadDropzone> | ||
<TopNav /> | ||
<Separator /> | ||
<div className="my-4 flex-1"> | ||
<Bookmarks | ||
header={<p className="text-2xl">Bookmarks</p>} | ||
query={{ archived: false }} | ||
showEditorCard={true} | ||
/> | ||
</div> | ||
</UploadDropzone> | ||
<TopNav /> | ||
<Separator /> | ||
<div className="my-4 flex-1"> | ||
<Bookmarks | ||
header={<p className="text-2xl">Bookmarks</p>} | ||
query={{ archived: false }} | ||
showEditorCard={true} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.