feat(dashboard): edit log channels page

This commit is contained in:
sam 2024-10-19 16:52:27 +02:00
parent ec7aa9faba
commit 32ddb9fae2
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
16 changed files with 471 additions and 95 deletions

View file

@ -1,28 +1,3 @@
export type User = {
id: string;
tag: string;
avatar_url: string;
};
export type PartialGuild = {
id: string;
name: string;
icon_url: string;
bot_in_guild: boolean;
};
export type CurrentUser = {
user: User;
guilds: PartialGuild[];
};
export type AuthCallback = CurrentUser & { token: string };
export type ApiError = {
error_code: string;
message: string;
};
export const TOKEN_KEY = "catalogger-token";
export default async function apiFetch<T>(
@ -53,3 +28,83 @@ export default async function apiFetch<T>(
return (await resp.json()) as T;
}
export type User = {
id: string;
tag: string;
avatar_url: string;
};
export type PartialGuild = {
id: string;
name: string;
icon_url: string;
bot_in_guild: boolean;
};
export type FullGuild = {
id: string;
name: string;
icon_url: string;
categories: GuildCategory[];
channels_without_category: GuildChannel[];
config: GuildConfig;
};
export type GuildCategory = {
id: string;
name: string;
channels: GuildChannel[];
};
export type GuildChannel = {
id: string;
name: string;
can_log_to: boolean;
can_redirect_from: boolean;
};
export type CurrentUser = {
user: User;
guilds: PartialGuild[];
};
export type AuthCallback = CurrentUser & { token: string };
export type ApiError = {
error_code: string;
message: string;
};
export type GuildConfig = GuildChannelConfig & {
ignored_channels: string[];
ignored_users: string[];
ignored_users_per_channel: Record<string, string[]>;
redirects: Record<string, string>;
};
export type GuildChannelConfig = {
guild_update: string;
guild_emojis_update: string;
guild_role_create: string;
guild_role_update: string;
guild_role_delete: string;
channel_create: string;
channel_update: string;
channel_delete: string;
guild_member_add: string;
guild_member_update: string;
guild_key_role_update: string;
guild_member_nick_update: string;
guild_member_avatar_update: string;
guild_member_timeout: string;
guild_member_remove: string;
guild_member_kick: string;
guild_ban_add: string;
guild_ban_remove: string;
invite_create: string;
invite_delete: string;
message_update: string;
message_delete: string;
message_delete_bulk: string;
};