chore: upgrade to tauri v2 stable
This commit is contained in:
17
src/app.tsx
17
src/app.tsx
@@ -1,24 +1,27 @@
|
||||
import { experimental_createPersister } from "@tanstack/query-persist-client-core";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { RouterProvider, createRouter } from "@tanstack/react-router";
|
||||
import { type } from "@tauri-apps/plugin-os";
|
||||
import { StrictMode } from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import { routeTree } from "./routes.gen"; // auto generated file
|
||||
import type { LumeEvent } from "./system";
|
||||
import "./app.css";
|
||||
import { experimental_createPersister } from "@tanstack/query-persist-client-core";
|
||||
import { Store } from "@tauri-apps/plugin-store";
|
||||
import { newQueryStorage } from "./commons";
|
||||
import type { LumeEvent } from "./system";
|
||||
|
||||
import "./app.css"; // global styles
|
||||
|
||||
import { createStore } from "@tauri-apps/plugin-store";
|
||||
import { routeTree } from "./routes.gen"; // auto generated file
|
||||
|
||||
const platform = type();
|
||||
const store = new Store(".cache");
|
||||
// @ts-ignore, https://github.com/tauri-apps/plugins-workspace/pull/1860
|
||||
const store = await createStore(".cache", { autoSave: 100 });
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
gcTime: 1000 * 30,
|
||||
persister: experimental_createPersister({
|
||||
storage: newQueryStorage(store),
|
||||
maxAge: 1000 * 60 * 60 * 12, // 12 hours
|
||||
maxAge: 1000 * 60 * 60 * 12,
|
||||
}),
|
||||
},
|
||||
},
|
||||
|
||||
20
src/components/icons/reply.tsx
Normal file
20
src/components/icons/reply.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { SVGProps } from "react";
|
||||
|
||||
export const ReplyIcon = (props: SVGProps<SVGSVGElement>) => (
|
||||
<svg
|
||||
width={24}
|
||||
height={24}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d="M21.75 12c0-5.156-3.792-8.25-9.75-8.25S2.25 6.844 2.25 12c0 1.337.92 3.605 1.064 3.952l.038.091c.099.27.505 1.71-1.102 3.84 2.167 1.031 4.468-.664 4.468-.664 1.592.84 3.486 1.031 5.282 1.031 5.958 0 9.75-3.094 9.75-8.25z"
|
||||
stroke="currentColor"
|
||||
strokeWidth={1.5}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
20
src/components/icons/repost.tsx
Normal file
20
src/components/icons/repost.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { SVGProps } from "react";
|
||||
|
||||
export const RepostIcon = (props: SVGProps<SVGSVGElement>) => (
|
||||
<svg
|
||||
width={24}
|
||||
height={24}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d="M10.75 1.5l3.5 3.25L10.75 8m2.5 8l-3.5 3.25 3.5 3.25m-2.5-3.25H14a7.25 7.25 0 004.755-12.723M13.25 4.75H10a7.25 7.25 0 00-4.754 12.724"
|
||||
stroke="currentColor"
|
||||
strokeWidth={1.5}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
20
src/components/icons/zap.tsx
Normal file
20
src/components/icons/zap.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { SVGProps } from "react";
|
||||
|
||||
export const ZapIcon = (props: SVGProps<SVGSVGElement>) => (
|
||||
<svg
|
||||
width={24}
|
||||
height={24}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d="M3.861 11.252l4.6-8a1 1 0 01.867-.502h7.053a1 1 0 01.895 1.447l-1.303 2.606a1 1 0 00.895 1.447h2.467c.891 0 1.337 1.077.707 1.707L9.103 20.897c-.701.7-1.885.063-1.687-.908l1.235-6.039a1 1 0 00-.98-1.2H4.728a1 1 0 01-.867-1.498z"
|
||||
stroke="currentColor"
|
||||
strokeWidth={1.5}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
@@ -13,3 +13,8 @@ export * from "./reply";
|
||||
// Global components
|
||||
export * from "./note";
|
||||
export * from "./user";
|
||||
|
||||
// Icons
|
||||
export * from "./icons/reply";
|
||||
export * from "./icons/repost";
|
||||
export * from "./icons/zap";
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { cn } from "@/commons";
|
||||
import { ReplyIcon } from "@/components";
|
||||
import { LumeWindow } from "@/system";
|
||||
import { ShareFat } from "@phosphor-icons/react";
|
||||
import * as Tooltip from "@radix-ui/react-tooltip";
|
||||
import { useNoteContext } from "../provider";
|
||||
|
||||
export function NoteReply({ large = false }: { large?: boolean }) {
|
||||
export function NoteReply({
|
||||
label = false,
|
||||
smol = false,
|
||||
}: { label?: boolean; smol?: boolean }) {
|
||||
const event = useNoteContext();
|
||||
|
||||
return (
|
||||
@@ -16,13 +19,13 @@ export function NoteReply({ large = false }: { large?: boolean }) {
|
||||
onClick={() => LumeWindow.openEditor(event.id)}
|
||||
className={cn(
|
||||
"inline-flex items-center justify-center text-neutral-800 dark:text-neutral-200",
|
||||
large
|
||||
label
|
||||
? "rounded-full h-7 gap-1.5 w-20 text-sm font-medium hover:bg-black/10 dark:hover:bg-white/10"
|
||||
: "size-7",
|
||||
)}
|
||||
>
|
||||
<ShareFat className="shrink-0 size-4" />
|
||||
{large ? "Reply" : null}
|
||||
<ReplyIcon className={cn("shrink-0", smol ? "size-4" : "size-5")} />
|
||||
{label ? "Reply" : null}
|
||||
</button>
|
||||
</Tooltip.Trigger>
|
||||
<Tooltip.Portal>
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import { appSettings, cn } from "@/commons";
|
||||
import { Spinner } from "@/components";
|
||||
import { RepostIcon, Spinner } from "@/components";
|
||||
import { LumeWindow } from "@/system";
|
||||
import { Repeat } from "@phosphor-icons/react";
|
||||
import { useStore } from "@tanstack/react-store";
|
||||
import { Menu, MenuItem } from "@tauri-apps/api/menu";
|
||||
import { message } from "@tauri-apps/plugin-dialog";
|
||||
import { useCallback, useState } from "react";
|
||||
import { useNoteContext } from "../provider";
|
||||
|
||||
export function NoteRepost({ large = false }: { large?: boolean }) {
|
||||
export function NoteRepost({
|
||||
label = false,
|
||||
smol = false,
|
||||
}: { label?: boolean; smol?: boolean }) {
|
||||
const visible = useStore(appSettings, (state) => state.display_repost_button);
|
||||
const event = useNoteContext();
|
||||
|
||||
@@ -65,7 +67,7 @@ export function NoteRepost({ large = false }: { large?: boolean }) {
|
||||
onClick={(e) => showContextMenu(e)}
|
||||
className={cn(
|
||||
"inline-flex items-center justify-center text-neutral-800 dark:text-neutral-200",
|
||||
large
|
||||
label
|
||||
? "rounded-full h-7 gap-1.5 w-24 text-sm font-medium hover:bg-black/10 dark:hover:bg-white/10"
|
||||
: "size-7",
|
||||
)}
|
||||
@@ -73,9 +75,14 @@ export function NoteRepost({ large = false }: { large?: boolean }) {
|
||||
{loading ? (
|
||||
<Spinner className="size-4" />
|
||||
) : (
|
||||
<Repeat className={cn("size-4", isRepost ? "text-blue-500" : "")} />
|
||||
<RepostIcon
|
||||
className={cn(
|
||||
smol ? "size-4" : "size-5",
|
||||
isRepost ? "text-blue-500" : "",
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
{large ? "Repost" : null}
|
||||
{label ? "Repost" : null}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { appSettings, cn } from "@/commons";
|
||||
import { ZapIcon } from "@/components";
|
||||
import { LumeWindow } from "@/system";
|
||||
import { Lightning } from "@phosphor-icons/react";
|
||||
import { useSearch } from "@tanstack/react-router";
|
||||
import { useStore } from "@tanstack/react-store";
|
||||
import { useNoteContext } from "../provider";
|
||||
|
||||
export function NoteZap({ large = false }: { large?: boolean }) {
|
||||
export function NoteZap({
|
||||
label = false,
|
||||
smol = false,
|
||||
}: { label?: boolean; smol?: boolean }) {
|
||||
const search = useSearch({ strict: false });
|
||||
const visible = useStore(appSettings, (state) => state.display_zap_button);
|
||||
const event = useNoteContext();
|
||||
@@ -18,13 +21,13 @@ export function NoteZap({ large = false }: { large?: boolean }) {
|
||||
onClick={() => LumeWindow.openZap(event.id, search.account)}
|
||||
className={cn(
|
||||
"inline-flex items-center justify-center text-neutral-800 dark:text-neutral-200",
|
||||
large
|
||||
label
|
||||
? "rounded-full h-7 gap-1.5 w-20 text-sm font-medium hover:bg-black/10 dark:hover:bg-white/10"
|
||||
: "size-7",
|
||||
)}
|
||||
>
|
||||
<Lightning className="size-4" />
|
||||
{large ? "Zap" : null}
|
||||
<ZapIcon className={smol ? "size-4" : "size-5"} />
|
||||
{label ? "Zap" : null}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -99,10 +99,10 @@ export const ReplyNote = memo(function ReplyNote({
|
||||
<span className="text-sm text-neutral-500">
|
||||
{replyTime(event.created_at)}
|
||||
</span>
|
||||
<div className="flex items-center justify-end gap-3">
|
||||
<Note.Reply />
|
||||
<Note.Repost />
|
||||
<Note.Zap />
|
||||
<div className="flex items-center justify-end gap-5">
|
||||
<Note.Reply smol />
|
||||
<Note.Repost smol />
|
||||
<Note.Zap smol />
|
||||
</div>
|
||||
</div>
|
||||
{event.replies?.length ? (
|
||||
@@ -180,10 +180,10 @@ function ChildReply({ event }: { event: LumeEvent }) {
|
||||
<span className="text-sm text-neutral-500">
|
||||
{replyTime(event.created_at)}
|
||||
</span>
|
||||
<div className="invisible group-hover:visible flex items-center justify-end gap-3">
|
||||
<Note.Reply />
|
||||
<Note.Repost />
|
||||
<Note.Zap />
|
||||
<div className="invisible group-hover:visible flex items-center justify-end gap-5">
|
||||
<Note.Reply smol />
|
||||
<Note.Repost smol />
|
||||
<Note.Zap smol />
|
||||
</div>
|
||||
</div>
|
||||
{event.replies?.length ? (
|
||||
|
||||
@@ -41,7 +41,7 @@ export const RepostNote = memo(function RepostNote({
|
||||
</div>
|
||||
<Note.Content className="px-3" />
|
||||
<div className="flex items-center justify-between px-3 mt-3 h-14">
|
||||
<div className="inline-flex items-center gap-3">
|
||||
<div className="inline-flex items-center gap-6">
|
||||
<Note.Open />
|
||||
<Note.Reply />
|
||||
<Note.Repost />
|
||||
|
||||
@@ -23,7 +23,7 @@ export const TextNote = memo(function TextNote({
|
||||
<Note.Menu />
|
||||
</div>
|
||||
<Note.Content className="px-3" />
|
||||
<div className="flex items-center gap-4 px-3 mt-3 h-14">
|
||||
<div className="flex items-center gap-6 px-3 mt-3 h-14">
|
||||
<Note.Open />
|
||||
<Note.Reply />
|
||||
<Note.Repost />
|
||||
|
||||
@@ -82,9 +82,9 @@ function RootEvent() {
|
||||
</div>
|
||||
<Note.ContentLarge className="px-3" />
|
||||
<div className="flex items-center gap-2 px-3 mt-6 h-12 rounded-b-xl bg-neutral-50 dark:bg-white/5">
|
||||
<Note.Reply large />
|
||||
<Note.Repost large />
|
||||
<Note.Zap large />
|
||||
<Note.Reply label />
|
||||
<Note.Repost label />
|
||||
<Note.Zap label />
|
||||
</div>
|
||||
</Note.Root>
|
||||
</Note.Provider>
|
||||
|
||||
@@ -17,6 +17,8 @@ export const Route = createFileRoute("/")({
|
||||
});
|
||||
}
|
||||
|
||||
return { accounts: accounts.filter((account) => !account.endsWith("Lume")) };
|
||||
return {
|
||||
accounts: accounts.filter((account) => !account.endsWith("Lume")),
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user