Skip to content

Commit fad0f89

Browse files
authored
Merge pull request #8 from karpolan/dev
Release 0.2.7
2 parents 98c0bef + 7ddc4dd commit fad0f89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+601
-362
lines changed

next.config.mjs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,6 @@ const nextConfig = {
1414

1515
reactStrictMode: true,
1616
// reactStrictMode: false,
17-
18-
// Note: redirects() is not working with "next export" :(
19-
// async redirects() {
20-
// const articleRedirects = ARTICLES.map((article) => {
21-
// const slug = article.replace(/ /g, '-');
22-
// return {
23-
// source: `/articles/${slug}`,
24-
// destination: `/article/${slug}`,
25-
// permanent: true,
26-
// };
27-
// });
28-
// return [...articleRedirects];
29-
// },
3017
};
3118

3219
export default nextConfig;

package-lock.json

Lines changed: 36 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextjs-mui-starter-ts",
3-
"version": "0.1.5",
3+
"version": "0.2.7",
44
"description": "_DESCRIPTION_",
55
"author": {
66
"name": "Anton Karpenko",
@@ -37,6 +37,7 @@
3737
"@emotion/styled": "latest",
3838
"@mui/icons-material": "latest",
3939
"@mui/material": "latest",
40+
"@mui/material-nextjs": "latest",
4041
"clsx": "latest",
4142
"copy-to-clipboard": "latest",
4243
"next": "latest",

src/app/dev/components/DemoAppButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useState } from 'react';
33
import copyToClipboard from 'copy-to-clipboard';
44
import { Card, CardContent, CardHeader, Snackbar } from '@mui/material';
55
import { AppButton } from '@/components';
6-
import { AppButtonProps } from '@/components/AppButton/AppButton';
6+
import { AppButtonProps } from '@/components/common/AppButton/AppButton';
77

88
/**
99
* Same as AppButton but with onClick handler that copies JSX code to Clipboard

src/app/dev/components/DemoAppIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useState } from 'react';
33
import copyToClipboard from 'copy-to-clipboard';
44
import { Box, Card, CardContent, CardHeader, Snackbar } from '@mui/material';
55
import { AppIconButton } from '@/components';
6-
import { ICONS } from '@/components/AppIcon/config';
6+
import { ICONS } from '@/components/common/AppIcon/config';
77

88
/**
99
* Renders "Demo Section" for AppIcon component

src/app/dev/components/DemoAppIconButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { useState } from 'react';
33
import copyToClipboard from 'copy-to-clipboard';
44
import { Box, Card, CardContent, CardHeader, Snackbar, Tooltip } from '@mui/material';
5-
import AppIconButton, { AppIconButtonProps } from '@/components/AppIconButton/AppIconButton';
5+
import AppIconButton, { AppIconButtonProps } from '@/components/common/AppIconButton/AppIconButton';
66

77
/**
88
* Same as AppIconButton but with onClick handler that copies JSX code to Clipboard

src/app/dev/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NextPage } from 'next';
22
import { redirect } from 'next/navigation';
33
import { Stack, Typography } from '@mui/material';
4+
import { IS_DEBUG } from '@/config';
45
import DemoAppAlert from './components/DemoAppAlerts';
56
import DemoAppButton from './components/DemoAppButton';
67
import DemoAppIcon from './components/DemoAppIcon';
@@ -12,9 +13,8 @@ import DemoAppImage from './components/DemoAppImage';
1213
* @page Dev
1314
*/
1415
const DevPage: NextPage = () => {
15-
if (!process.env.NEXT_PUBLIC_DEBUG) {
16+
if (!IS_DEBUG) {
1617
redirect('/');
17-
return null; // Hide this page on when env.NEXT_PUBLIC_DEBUG is not set
1818
}
1919

2020
return (

src/app/me/page.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Stack } from '@mui/material';
2+
import { NextPage } from 'next';
3+
import { AppAlert, UserInfo } from '../../components';
4+
5+
/**
6+
* Renders User Profile Page
7+
* @page Me
8+
*/
9+
const MeAkaProfilePage: NextPage = () => {
10+
return (
11+
<Stack spacing={2} padding={2}>
12+
<AppAlert severity="warning">This page is under construction</AppAlert>
13+
<UserInfo showAvatar />
14+
</Stack>
15+
);
16+
};
17+
18+
export default MeAkaProfilePage;

src/components/NotImplemented.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Avatar, Stack, Typography } from '@mui/material';
2+
import { AppLink } from '../common';
3+
4+
interface UserInfoProps {
5+
className?: string;
6+
showAvatar?: boolean;
7+
user?: any;
8+
}
9+
10+
/**
11+
* Renders User info with Avatar
12+
* @component UserInfo
13+
* @param {boolean} [showAvatar] - user's avatar picture is shown when true
14+
* @param {object} [user] - logged user data {name, email, avatar...}
15+
*/
16+
const UserInfo = ({ showAvatar = false, user, ...restOfProps }: UserInfoProps) => {
17+
const fullName = user?.name || [user?.nameFirst || '', user?.nameLast || ''].join(' ').trim();
18+
const srcAvatar = user?.avatar ? user?.avatar : undefined;
19+
const userPhoneOrEmail = user?.phone || (user?.email as string);
20+
21+
return (
22+
<Stack alignItems="center" minHeight="fit-content" marginBottom={2} {...restOfProps}>
23+
{showAvatar ? (
24+
<AppLink to="/me" underline="none">
25+
<Avatar
26+
sx={{
27+
width: 64,
28+
height: 64,
29+
fontSize: '3rem',
30+
}}
31+
alt={fullName || 'User Avatar'}
32+
src={srcAvatar}
33+
/>
34+
</AppLink>
35+
) : null}
36+
<Typography sx={{ mt: 1 }} variant="h6">
37+
{fullName || 'Current User'}
38+
</Typography>
39+
<Typography variant="body2">{userPhoneOrEmail || 'Loading...'}</Typography>
40+
</Stack>
41+
);
42+
};
43+
44+
export default UserInfo;

0 commit comments

Comments
 (0)