signal-desktop/sticker-creator/app/index.tsx

61 lines
1.8 KiB
TypeScript
Raw Normal View History

2020-10-30 20:34:04 +00:00
// Copyright 2019-2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2019-12-17 20:25:57 +00:00
import * as React from 'react';
import { Redirect, Route, Switch } from 'react-router-dom';
import { DropStage } from './stages/DropStage';
import { EmojiStage } from './stages/EmojiStage';
import { UploadStage } from './stages/UploadStage';
import { MetaStage } from './stages/MetaStage';
import { ShareStage } from './stages/ShareStage';
import * as styles from './index.scss';
import { PageHeader } from '../elements/PageHeader';
import { useI18n } from '../util/i18n';
import { TitleBarContainer } from '../../ts/components/TitleBarContainer';
import type { ExecuteMenuRoleType } from '../../ts/components/TitleBarContainer';
import { useTheme } from '../../ts/hooks/useTheme';
2019-12-17 20:25:57 +00:00
export type AppPropsType = Readonly<{
executeMenuRole: ExecuteMenuRoleType;
2022-07-05 16:44:53 +00:00
hasCustomTitleBar: boolean;
}>;
2022-11-18 00:45:19 +00:00
export function App({
executeMenuRole,
2022-07-05 16:44:53 +00:00
hasCustomTitleBar,
2022-11-18 00:45:19 +00:00
}: AppPropsType): JSX.Element {
2019-12-17 20:25:57 +00:00
const i18n = useI18n();
const theme = useTheme();
2019-12-17 20:25:57 +00:00
return (
<TitleBarContainer
iconSrc="../../images/icon_32.png"
2022-07-05 16:44:53 +00:00
hasCustomTitleBar={hasCustomTitleBar}
theme={theme}
executeMenuRole={executeMenuRole}
>
<div className={styles.container}>
<PageHeader>{i18n('StickerCreator--title')}</PageHeader>
<Switch>
<Route path="/drop">
<DropStage />
</Route>
<Route path="/add-emojis">
<EmojiStage />
</Route>
<Route path="/add-meta">
<MetaStage />
</Route>
<Route path="/upload">
<UploadStage />
</Route>
<Route path="/share">
<ShareStage />
</Route>
<Redirect to="/drop" />
</Switch>
</div>
</TitleBarContainer>
2019-12-17 20:25:57 +00:00
);
2022-11-18 00:45:19 +00:00
}