Redesign mobile time clock, add shortcuts, and improve account management.

Add iOS Shortcuts/Siri intents, local send-reminder notifications, stable
client picker with last-client defaults, account refresh/remove, and softer
session handling on unauthorized API responses.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-22 16:06:17 -04:00
parent 0b2d65a4e9
commit 06bc91ac13
33 changed files with 1844 additions and 320 deletions
+23 -16
View File
@@ -1,28 +1,35 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { httpBatchLink } from "@trpc/client";
import { createTRPCReact } from "@trpc/react-query";
import { useState, type ReactNode } from "react";
import { useCallback, useRef, useState, type ReactNode } from "react";
import SuperJSON from "superjson";
import { useAuthClient } from "@/contexts/AuthContext";
import { useAuthClient, useSession } from "@/contexts/AuthContext";
import { createAppQueryClient } from "@/lib/query-client";
import type { AppRouter } from "beenvoice/server/api/root";
export const api = createTRPCReact<AppRouter>();
function createQueryClient() {
return new QueryClient({
defaultOptions: {
queries: {
staleTime: 30_000,
retry: 1,
},
},
});
}
export function TRPCProvider({ apiUrl, children }: { apiUrl: string; children: ReactNode }) {
const authClient = useAuthClient();
const [queryClient] = useState(createQueryClient);
const { refetch } = useSession();
const handleUnauthorized = useCallback(async () => {
const session = await authClient.getSession();
if (!session.data?.user) {
await authClient.signOut();
await refetch();
}
}, [authClient, refetch]);
const onUnauthorizedRef = useRef(handleUnauthorized);
onUnauthorizedRef.current = handleUnauthorized;
const [queryClient] = useState(() =>
createAppQueryClient(() => {
void onUnauthorizedRef.current();
}),
);
const [trpcClient] = useState(() =>
api.createClient({
links: [
@@ -42,7 +49,7 @@ export function TRPCProvider({ apiUrl, children }: { apiUrl: string; children: R
return (
<api.Provider client={trpcClient} queryClient={queryClient}>
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
{children}
</api.Provider>
);
}