src: first layout, many dependencies

- setup query templates and potential auth flow/state
- basic server & channel lists
- guessed types for db and apis
- user panel / settings templates
- many steps left
This commit is contained in:
2025-09-27 03:38:42 -04:00
parent f069340bab
commit 1592703149
45 changed files with 3583 additions and 198 deletions

View File

@@ -0,0 +1,72 @@
// src/hooks/useChannels.ts
import { useQuery } from "@tanstack/react-query";
import { CategoryWithChannels } from "@/types/api";
// Placeholder hook for channels by instance
export const useChannels = (instanceId?: string) => {
return useQuery({
queryKey: ["channels", instanceId],
queryFn: async (): Promise<CategoryWithChannels[]> => {
if (!instanceId || instanceId === "@me") return [];
// TODO: Replace with actual API call
return [
{
id: "1",
name: "Text Channels",
instanceId: instanceId,
position: 0,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
channels: [
{
id: "1",
name: "general",
type: "text",
categoryId: "1",
instanceId: instanceId,
position: 0,
topic: "General discussion",
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
{
id: "2",
name: "random",
type: "text",
categoryId: "1",
instanceId: instanceId,
position: 1,
topic: "Random chat",
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
],
},
{
id: "2",
name: "Voice Channels",
instanceId: instanceId,
position: 1,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
channels: [
{
id: "3",
name: "General",
type: "voice",
categoryId: "2",
instanceId: instanceId,
position: 0,
topic: "",
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
],
},
];
},
enabled: !!instanceId && instanceId !== "@me",
staleTime: 1000 * 60 * 5, // 5 minutes
});
};