feat: Introduce comprehensive user settings, voice, chat, and screen sharing features with new components, contexts, icons, and Convex backend integrations.
All checks were successful
Build and Release / build-and-release (push) Successful in 13m55s

This commit is contained in:
Bryan1029384756
2026-02-18 14:48:57 -06:00
parent a9490f7bd4
commit bdc16b9d3f
22 changed files with 755 additions and 126 deletions

View File

@@ -224,6 +224,109 @@ export const fetchBulkPage = query({
},
});
export const listAround = query({
args: {
channelId: v.id("channels"),
messageId: v.id("messages"),
userId: v.optional(v.id("userProfiles")),
},
returns: v.any(),
handler: async (ctx, args) => {
const target = await ctx.db.get(args.messageId);
if (!target || target.channelId !== args.channelId) {
return { messages: [], hasOlder: false, hasNewer: false, targetFound: false };
}
const targetTime = target._creationTime;
const before = await ctx.db
.query("messages")
.withIndex("by_channel", (q) =>
q.eq("channelId", args.channelId).lt("_creationTime", targetTime)
)
.order("desc")
.take(26);
const after = await ctx.db
.query("messages")
.withIndex("by_channel", (q) =>
q.eq("channelId", args.channelId).gt("_creationTime", targetTime)
)
.order("asc")
.take(26);
const hasOlder = before.length > 25;
const hasNewer = after.length > 25;
const olderMessages = before.slice(0, 25).reverse();
const newerMessages = after.slice(0, 25);
const allRaw = [...olderMessages, target, ...newerMessages];
const messages = await Promise.all(
allRaw.map((msg) => enrichMessage(ctx, msg, args.userId))
);
return { messages, hasOlder, hasNewer, targetFound: true };
},
});
export const listBefore = query({
args: {
channelId: v.id("channels"),
beforeTimestamp: v.number(),
userId: v.optional(v.id("userProfiles")),
limit: v.optional(v.number()),
},
returns: v.any(),
handler: async (ctx, args) => {
const limit = args.limit ?? 50;
const rows = await ctx.db
.query("messages")
.withIndex("by_channel", (q) =>
q.eq("channelId", args.channelId).lt("_creationTime", args.beforeTimestamp)
)
.order("desc")
.take(limit + 1);
const hasMore = rows.length > limit;
const page = rows.slice(0, limit);
const messages = await Promise.all(
page.reverse().map((msg) => enrichMessage(ctx, msg, args.userId))
);
return { messages, hasMore };
},
});
export const listAfter = query({
args: {
channelId: v.id("channels"),
afterTimestamp: v.number(),
userId: v.optional(v.id("userProfiles")),
limit: v.optional(v.number()),
},
returns: v.any(),
handler: async (ctx, args) => {
const limit = args.limit ?? 50;
const rows = await ctx.db
.query("messages")
.withIndex("by_channel", (q) =>
q.eq("channelId", args.channelId).gt("_creationTime", args.afterTimestamp)
)
.order("asc")
.take(limit + 1);
const hasMore = rows.length > limit;
const page = rows.slice(0, limit);
const messages = await Promise.all(
page.map((msg) => enrichMessage(ctx, msg, args.userId))
);
return { messages, hasMore };
},
});
export const remove = mutation({
args: { id: v.id("messages"), userId: v.id("userProfiles") },
returns: v.null(),