2024-09-05 12:20:21 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) Contributors to the Suwayomi project
|
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
import Stack from '@mui/material/Stack';
|
|
|
|
|
import Button from '@mui/material/Button';
|
|
|
|
|
import AddCircleIcon from '@mui/icons-material/AddCircle';
|
|
|
|
|
import { bindDialog, bindTrigger, usePopupState } from 'material-ui-popup-state/hooks';
|
2025-08-15 22:02:58 +02:00
|
|
|
import { CustomTooltip } from '@/features/core/components/CustomTooltip.tsx';
|
|
|
|
|
import { ThemeCreationDialog } from '@/features/theme/components/CreateThemeDialog.tsx';
|
|
|
|
|
import { TypographyMaxLines } from '@/features/core/components/texts/TypographyMaxLines.tsx';
|
2024-09-05 12:20:21 +02:00
|
|
|
|
|
|
|
|
export const CreateThemeButton = () => {
|
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
|
|
const popupState = usePopupState({ variant: 'popover', popupId: 'theme-creation-dialog' });
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
2024-09-09 22:31:29 +02:00
|
|
|
<Stack sx={{ alignItems: 'center', gap: 1, minWidth: '150px', maxWidth: '150px' }}>
|
2024-09-05 12:20:21 +02:00
|
|
|
<Button
|
2024-09-06 23:29:40 +02:00
|
|
|
sx={{
|
2024-09-09 22:31:29 +02:00
|
|
|
width: '100%',
|
2024-09-06 23:29:40 +02:00
|
|
|
height: '225px',
|
|
|
|
|
}}
|
2024-09-05 12:20:21 +02:00
|
|
|
variant="contained"
|
|
|
|
|
size="large"
|
|
|
|
|
{...bindTrigger(popupState)}
|
|
|
|
|
>
|
2024-09-09 22:34:43 +02:00
|
|
|
<AddCircleIcon fontSize="large" />
|
2024-09-05 12:20:21 +02:00
|
|
|
</Button>
|
2025-02-01 14:24:38 +01:00
|
|
|
<CustomTooltip title={t('settings.appearance.theme.create.title')} placement="top">
|
2024-09-09 22:31:29 +02:00
|
|
|
<TypographyMaxLines sx={{ maxWidth: '100%' }}>
|
|
|
|
|
{t('settings.appearance.theme.create.title')}
|
|
|
|
|
</TypographyMaxLines>
|
2025-02-01 14:24:38 +01:00
|
|
|
</CustomTooltip>
|
2024-09-05 12:20:21 +02:00
|
|
|
</Stack>
|
|
|
|
|
{popupState.isOpen && <ThemeCreationDialog bindDialogProps={bindDialog(popupState)} mode="create" />}
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|