Skip to content

Commit 5e2a587

Browse files
authored
feat: Add marketing bento on home and dashboard (#450)
1 parent 6038258 commit 5e2a587

File tree

4 files changed

+158
-5
lines changed

4 files changed

+158
-5
lines changed

β€Žnext.config.mjs

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ const withPWA = withPWAInit({
1111

1212
/** @type {import("next").NextConfig} */
1313
const config = withPWA({
14+
images: {
15+
remotePatterns: [
16+
{
17+
hostname: 'raw.githubusercontent.com',
18+
pathname: '/BearStudio/**',
19+
},
20+
],
21+
},
1422
async redirects() {
1523
return [
1624
{

β€Žsrc/features/admin-dashboard/PageAdminDashboard.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ import {
1919
AdminLayoutPage,
2020
AdminLayoutPageContent,
2121
} from '@/features/admin/AdminLayoutPage';
22+
import { MarketingBento } from '@/features/demo-mode/MarketingBento';
2223

2324
export default function PageAdminDashboard() {
2425
const { t } = useTranslation(['adminDashboard']);
2526
return (
26-
<AdminLayoutPage>
27+
<AdminLayoutPage containerMaxWidth="container.md">
2728
<AdminLayoutPageContent>
2829
<Heading size="md" mb="4">
2930
{t('adminDashboard:title')}
@@ -70,6 +71,7 @@ export default function PageAdminDashboard() {
7071
{t('adminDashboard:links.openIssue')}
7172
</Button>
7273
</Wrap>
74+
<MarketingBento />
7375
</Stack>
7476
</AdminLayoutPageContent>
7577
</AdminLayoutPage>

β€Žsrc/features/app-home/PageHome.tsx

+44-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,40 @@
11
import React from 'react';
22

3-
import { Button, Flex, Heading, Stack, Text, Wrap } from '@chakra-ui/react';
3+
import {
4+
Alert,
5+
AlertTitle,
6+
Button,
7+
Flex,
8+
Heading,
9+
Link,
10+
LinkBox,
11+
LinkOverlay,
12+
Stack,
13+
Text,
14+
Wrap,
15+
} from '@chakra-ui/react';
416
import { Trans, useTranslation } from 'react-i18next';
5-
import { LuAlertCircle, LuBookOpen, LuGithub } from 'react-icons/lu';
17+
import {
18+
LuAlertCircle,
19+
LuBookOpen,
20+
LuExternalLink,
21+
LuGithub,
22+
} from 'react-icons/lu';
623

24+
import { Icon } from '@/components/Icons';
725
import { Logo } from '@/components/Logo';
26+
import { ADMIN_PATH } from '@/features/admin/constants';
827
import { AppLayoutPage } from '@/features/app/AppLayoutPage';
28+
import { MarketingBento } from '@/features/demo-mode/MarketingBento';
29+
import { trpc } from '@/lib/trpc/client';
930

1031
export default function PageHome() {
11-
const { t } = useTranslation(['appHome']);
32+
const account = trpc.account.get.useQuery();
33+
const { t } = useTranslation(['appHome', 'account']);
1234

1335
return (
1436
<AppLayoutPage>
15-
<Stack flex={1} spacing={4}>
37+
<Stack flex={1} spacing={6}>
1638
<Flex
1739
display={{ base: 'flex', md: 'none' }}
1840
py={2}
@@ -32,6 +54,7 @@ export default function PageHome() {
3254
</Text>
3355
</Text>
3456
</Stack>
57+
3558
<Wrap spacing="2">
3659
<Button
3760
size="sm"
@@ -58,6 +81,23 @@ export default function PageHome() {
5881
{t('appHome:links.openIssue')}
5982
</Button>
6083
</Wrap>
84+
{account.isSuccess && account.data.authorizations.includes('ADMIN') && (
85+
<Alert as={LinkBox} colorScheme="brand">
86+
<AlertTitle flex="none">{t('account:admin.title')}</AlertTitle>
87+
<Link
88+
as={LinkOverlay}
89+
ms="auto"
90+
gap={2}
91+
display="inline-flex"
92+
href={ADMIN_PATH || '/'}
93+
target="_blank"
94+
>
95+
{t('account:admin.button')}
96+
<Icon icon={LuExternalLink} />
97+
</Link>
98+
</Alert>
99+
)}
100+
<MarketingBento />
61101
</Stack>
62102
</AppLayoutPage>
63103
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import { Grid, GridItem, Text } from '@chakra-ui/react';
2+
import Image from 'next/image';
3+
import Link from 'next/link';
4+
5+
export const MarketingBento = () => {
6+
return (
7+
<Grid
8+
gap="2"
9+
templateColumns={{ base: 'repeat(2, 1fr)', sm: 'repeat(3, 1fr)' }}
10+
>
11+
<GridItem
12+
borderRadius="md"
13+
bg="blackAlpha.200"
14+
rowSpan={2}
15+
aspectRatio={0.7}
16+
overflow="hidden"
17+
>
18+
<Link
19+
href="https://bear.studio/assets-start-ui-bento-01"
20+
target="_blank"
21+
>
22+
<Image
23+
src="https://raw.githubusercontent.com/BearStudio/assets/main/start-ui/marketing-bento-01.jpg"
24+
alt="Marketing content. Follow link for more info"
25+
width={420}
26+
height={600}
27+
sizes="420px"
28+
style={{ objectFit: 'cover' }}
29+
/>
30+
</Link>
31+
</GridItem>
32+
<GridItem
33+
borderRadius="md"
34+
bg="blackAlpha.200"
35+
aspectRatio={1.45}
36+
overflow="hidden"
37+
>
38+
<Link
39+
href="https://bear.studio/assets-start-ui-bento-02"
40+
target="_blank"
41+
>
42+
<Image
43+
src="https://raw.githubusercontent.com/BearStudio/assets/main/start-ui/marketing-bento-02.jpg"
44+
alt="Marketing content. Follow link for more info"
45+
width={420}
46+
height={290}
47+
sizes="420px"
48+
style={{ objectFit: 'cover' }}
49+
/>
50+
</Link>
51+
</GridItem>
52+
<GridItem
53+
borderRadius="md"
54+
bg="blackAlpha.200"
55+
rowSpan={2}
56+
aspectRatio={0.7}
57+
overflow="hidden"
58+
>
59+
<Link
60+
href="https://bear.studio/assets-start-ui-bento-03"
61+
target="_blank"
62+
>
63+
<Image
64+
src="https://raw.githubusercontent.com/BearStudio/assets/main/start-ui/marketing-bento-03.jpg"
65+
alt="Marketing content. Follow link for more info"
66+
width={420}
67+
height={600}
68+
sizes="420px"
69+
style={{ objectFit: 'cover' }}
70+
/>
71+
</Link>
72+
</GridItem>
73+
<GridItem
74+
borderRadius="md"
75+
bg="blackAlpha.200"
76+
aspectRatio={1.45}
77+
overflow="hidden"
78+
>
79+
<Link
80+
href="https://bear.studio/assets-start-ui-bento-04"
81+
target="_blank"
82+
>
83+
<Image
84+
src="https://raw.githubusercontent.com/BearStudio/assets/main/start-ui/marketing-bento-04.jpg"
85+
alt="Marketing content. Follow link for more info"
86+
width={420}
87+
height={290}
88+
sizes="420px"
89+
style={{ objectFit: 'cover' }}
90+
/>
91+
</Link>
92+
</GridItem>
93+
<Text
94+
fontSize="xs"
95+
gridColumn="1/-1"
96+
textAlign="center"
97+
style={{ textWrap: 'balance' }}
98+
>
99+
Shameless plug πŸ˜… Remember that πŸš€ Start UI is free and Open Source πŸ˜‰
100+
</Text>
101+
</Grid>
102+
);
103+
};

0 commit comments

Comments
Β (0)