feat: Initialize the Electron frontend with core UI components and integrate Convex backend services.

This commit is contained in:
Bryan1029384756
2026-02-10 18:29:42 -06:00
parent 34e9790db9
commit 17790afa9b
64 changed files with 149216 additions and 628 deletions

View File

@@ -31,13 +31,16 @@ export const list = query({
_creationTime: v.number(),
name: v.string(),
type: v.string(),
category: v.optional(v.string()),
topic: v.optional(v.string()),
position: v.optional(v.number()),
})
),
handler: async (ctx) => {
const channels = await ctx.db.query("channels").collect();
return channels
.filter((c) => c.type !== "dm")
.sort((a, b) => a.name.localeCompare(b.name));
.sort((a, b) => (a.position ?? 0) - (b.position ?? 0) || a.name.localeCompare(b.name));
},
});
@@ -50,6 +53,9 @@ export const get = query({
_creationTime: v.number(),
name: v.string(),
type: v.string(),
category: v.optional(v.string()),
topic: v.optional(v.string()),
position: v.optional(v.number()),
}),
v.null()
),
@@ -63,6 +69,9 @@ export const create = mutation({
args: {
name: v.string(),
type: v.optional(v.string()),
category: v.optional(v.string()),
topic: v.optional(v.string()),
position: v.optional(v.number()),
},
returns: v.object({ id: v.id("channels") }),
handler: async (ctx, args) => {
@@ -82,12 +91,30 @@ export const create = mutation({
const id = await ctx.db.insert("channels", {
name: args.name,
type: args.type || "text",
category: args.category,
topic: args.topic,
position: args.position,
});
return { id };
},
});
// Update channel topic
export const updateTopic = mutation({
args: {
id: v.id("channels"),
topic: v.string(),
},
returns: v.null(),
handler: async (ctx, args) => {
const channel = await ctx.db.get(args.id);
if (!channel) throw new Error("Channel not found");
await ctx.db.patch(args.id, { topic: args.topic });
return null;
},
});
// Rename channel
export const rename = mutation({
args: {
@@ -99,6 +126,9 @@ export const rename = mutation({
_creationTime: v.number(),
name: v.string(),
type: v.string(),
category: v.optional(v.string()),
topic: v.optional(v.string()),
position: v.optional(v.number()),
}),
handler: async (ctx, args) => {
if (!args.name.trim()) {