/* * Copyright (C) 2026 Fluxer Contributors * * This file is part of Fluxer. * * Fluxer is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Fluxer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Fluxer. If not, see . */ /** @jsxRuntime automatic */ /** @jsxImportSource hono/jsx */ import {hasPermission} from '@fluxer/admin/src/AccessControlList'; import {getErrorMessage} from '@fluxer/admin/src/api/Errors'; import {listGuildStickers} from '@fluxer/admin/src/api/GuildAssets'; import {ErrorCard} from '@fluxer/admin/src/components/ErrorDisplay'; import {Badge} from '@fluxer/admin/src/components/ui/Badge'; import {HStack} from '@fluxer/admin/src/components/ui/Layout/HStack'; import {VStack} from '@fluxer/admin/src/components/ui/Layout/VStack'; import {Stack} from '@fluxer/admin/src/components/ui/Stack'; import {Caption, Heading, Text} from '@fluxer/admin/src/components/ui/Typography'; import type {Session} from '@fluxer/admin/src/types/App'; import type {AdminConfig as Config} from '@fluxer/admin/src/types/Config'; import {AdminACLs} from '@fluxer/constants/src/AdminACLs'; import type {GuildStickerAsset} from '@fluxer/schema/src/domains/admin/AdminSchemas'; import {Button} from '@fluxer/ui/src/components/Button'; import {Card} from '@fluxer/ui/src/components/Card'; import {CsrfInput} from '@fluxer/ui/src/components/CsrfInput'; import type {FC} from 'hono/jsx'; interface StickersTabProps { config: Config; session: Session; guildId: string; adminAcls: Array; csrfToken: string; } function stickerAnimatedLabel(animated: boolean): string { return animated ? 'Animated' : 'Static'; } const RenderPermissionNotice: FC = () => ( Permission required You need the {AdminACLs.ASSET_PURGE} ACL to manage guild stickers. ); const RenderStickerCard: FC<{config: Config; guildId: string; sticker: GuildStickerAsset; csrfToken: string}> = ({ config, guildId, sticker, csrfToken, }) => { return ( {sticker.name} {sticker.name} {stickerAnimatedLabel(sticker.animated)} ID: {sticker.id} Uploader: {sticker.creator_id}
); }; const RenderStickers: FC<{config: Config; guildId: string; stickers: Array; csrfToken: string}> = ({ config, guildId, stickers, csrfToken, }) => { return ( Stickers ({stickers.length}) {stickers.length === 0 ? ( No stickers found for this guild. ) : (
{stickers.map((sticker) => ( ))}
)}
); }; export async function StickersTab({config, session, guildId, adminAcls, csrfToken}: StickersTabProps) { const hasAssetPurge = hasPermission(adminAcls, AdminACLs.ASSET_PURGE); if (!hasAssetPurge) { return ; } const result = await listGuildStickers(config, session, guildId); if (!result.ok) { return ( Back to Guild ); } return ; }