Skip to content

Commit 4dbf18d

Browse files
authored
fix: do not show template for selfhosting (#180)
1 parent 3de8aaa commit 4dbf18d

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@atlaskit/primitives": "^5.5.3",
5858
"@emoji-mart/data": "^1.1.2",
5959
"@emoji-mart/react": "^1.1.1",
60+
"@emotion/is-prop-valid": "^1.4.0",
6061
"@emotion/react": "^11.10.6",
6162
"@emotion/styled": "^11.10.6",
6263
"@floating-ui/react": "^0.26.27",

pnpm-lock.yaml

Lines changed: 10 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/app/SideBarBottom.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
11
import { IconButton, Tooltip } from '@mui/material';
2+
import { useMemo } from 'react';
23
import { useTranslation } from 'react-i18next';
34
import { useNavigate } from 'react-router-dom';
45

56
import { ReactComponent as TrashIcon } from '@/assets/icons/delete.svg';
67
import { ReactComponent as TemplateIcon } from '@/assets/icons/template.svg';
78
import { QuickNote } from '@/components/quick-note';
9+
import { isOfficialHost } from '@/utils/subscription';
810

911
function SideBarBottom() {
1012
const { t } = useTranslation();
1113
const navigate = useNavigate();
14+
const isOfficial = useMemo(() => isOfficialHost(), []);
1215

1316
return (
1417
<div className={'sticky bottom-0 bg-surface-container-layer-00 px-4'}>
1518
<div className={'flex items-center justify-around gap-1 border-t border-border-primary py-4'}>
16-
<Tooltip title={t('template.label')}>
17-
<IconButton
18-
size={'small'}
19-
onClick={() => {
20-
window.open(`${window.location.origin}/templates`, '_blank');
21-
}}
22-
>
23-
<TemplateIcon />
24-
</IconButton>
25-
</Tooltip>
19+
{isOfficial && (
20+
<Tooltip title={t('template.label')}>
21+
<IconButton
22+
size={'small'}
23+
onClick={() => {
24+
window.open(`${window.location.origin}/templates`, '_blank');
25+
}}
26+
>
27+
<TemplateIcon />
28+
</IconButton>
29+
</Tooltip>
30+
)}
2631

2732
<Tooltip title={t('trash.text')}>
2833
<IconButton

0 commit comments

Comments
 (0)