/* * 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 . */ import {Trans, useLingui} from '@lingui/react/macro'; import {PaletteIcon, QuestionIcon} from '@phosphor-icons/react'; import {observer} from 'mobx-react-lite'; import * as ThemeActionCreators from '~/actions/ThemeActionCreators'; import { EmbedCard, EmbedSkeletonButton, EmbedSkeletonCircle, EmbedSkeletonSubtitle, EmbedSkeletonTitle, } from '~/components/embeds/EmbedCard/EmbedCard'; import cardStyles from '~/components/embeds/EmbedCard/EmbedCard.module.css'; import {useEmbedSkeletonOverride} from '~/components/embeds/EmbedCard/useEmbedSkeletonOverride'; import {Button} from '~/components/uikit/Button/Button'; import {useThemeExists} from '~/hooks/useThemeExists'; import styles from './ThemeEmbed.module.css'; interface ThemeEmbedProps { themeId: string; } export const ThemeEmbed = observer(function ThemeEmbed({themeId}: ThemeEmbedProps) { const {t, i18n} = useLingui(); const status = useThemeExists(themeId); const shouldForceSkeleton = useEmbedSkeletonOverride(); const handleImport = () => { ThemeActionCreators.openAcceptModal(themeId, i18n); }; if (shouldForceSkeleton || status === 'loading') { return ; } if (status === 'error') { return ; } return ( } title={

{t`Shared theme`}

} subtitle={ You've got CSS! } footer={ } /> ); }); const ThemeLoadingState = observer(() => { return ( } title={} subtitle={} footer={} /> ); }); const ThemeUnavailableError = observer(({message}: {message: string | null}) => { const {t} = useLingui(); return ( } title={

{t`Theme unavailable`}

} subtitle={{message ?? t`This theme is no longer available.`}} footer={ } /> ); });