Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Next.js 14 with App Router and Mantine 7 #12

Merged
merged 18 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/big-lamps-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': patch
---

added logic for active link styles
5 changes: 5 additions & 0 deletions .changeset/curvy-walls-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': patch
---

added mantine sliders, dates, buttons stories
5 changes: 5 additions & 0 deletions .changeset/cyan-parents-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': minor
---

added and setup prettier, husky and lint-staged
5 changes: 5 additions & 0 deletions .changeset/dull-glasses-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': patch
---

added usefetchdata hook for all mock data replacing the previous data imports
5 changes: 5 additions & 0 deletions .changeset/four-cougars-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': minor
---

updated side nav background color
40 changes: 40 additions & 0 deletions .changeset/large-deers-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
"analytics-dashboard": major
---

Upgrade to Next.js 14 with App Router and Mantine 7

# Summary

This major release marks a significant upgrade to the website, transitioning from Next.js 13 to 14 with App Router and from Mantine 6 to 7. This upgrade brings about substantial enhancements in performance, accessibility, user experience, and overall development practices.

# Next.js

- Project Structure: Aligned the project structure with the recommended guidelines for Next.js and App Router, enhancing organization and maintainability.
- Pages and Layouts: Optimized the pages and layouts structure to align with Next.js and App Router best practices, ensuring a more structured and efficient codebase.
- Pages Metadata: Updated each page's metadata content to provide more accurate and informative descriptions for search engines.
- Error Pages: Deprecated the individual 403, 404, and 500 error pages and adopted a unified "not-found" page for 404 errors and a generic error page for other server-side errors.
- Navigation Progress Bar: Discontinued the navigation progress bar for in-page transitions and implemented a centralized loading.tsx file to handle all in-page loading animations.

# Mantine

- CreateStyles: Adopted CSS Modules as the preferred method for styling components, replacing the deprecated createStyles function.
- Sx Prop: Replaced the deprecated sx prop with className or style prop for styling components in Mantine 7.0.
- Theme and ColorScheme: Refactored the theme and colour scheme usage across the codebase to align with Mantine 7.0 conventions.
- Dynamic Multicolor Theme: Deprecated the dynamic multicolour theme change feature and centralized theme configuration in the theme/index.tsx file.

# New Features

- Collapsible Side Navigation: Introduced a collapsible side navigation panel for enhanced user interface and navigation experience.
- Active Link Styles: Implemented logic to dynamically apply active link styles to the side navigation menu, providing clear visual cues for the currently selected page.
- Dark/Light Theme Switch: Integrated a dark/light theme toggle switch on the navigation header, enabling users to personalize their viewing experience.
- Loading Animations: Added loading animations to components rendering mock data, providing visual feedback during data fetching and processing.
- Custom useFetch Hook: Developed a custom useFetch hook to streamline data fetching across the application. This hook encapsulates data fetching logic, returning data, loading, and error states, and utilizes the native JavaScript fetch API.
- Code Formatting: Implemented Prettier, Husky, and lint-staged to enforce consistent code formatting and maintain a high level of code quality.
- Clerk Integration: Integrated Clerk (https://clerk.com/) to extend user authentication and management capabilities, providing a seamless user experience.
- NextAuth with Auth0: Implemented NextAuth with Auth0 (https://auth0.com/) for user authentication, leveraging NextAuth's flexibility and Auth0's robust identity management platform.
- Component Documentation Stories: Created component documentation stories using Storybook to provide clear and interactive documentation for each component.

# Bug Fixes

- General Bug Fixes: Addressed a variety of bugs and issues to enhance overall stability and performance.
5 changes: 5 additions & 0 deletions .changeset/moody-peaches-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': minor
---

updated pages metadata bug removed head tags in pages added color mode switch moved color mode switch to header removed theme drawer because no logic for color switching yet
5 changes: 5 additions & 0 deletions .changeset/odd-mails-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': patch
---

added chats loading animation, updated chats data to fetch using fetch data hook
5 changes: 5 additions & 0 deletions .changeset/plenty-seas-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': minor
---

updated all pages metatadata
5 changes: 5 additions & 0 deletions .changeset/polite-adults-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': patch
---

removed 403 page because of build time errors
5 changes: 5 additions & 0 deletions .changeset/polite-apples-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': major
---

upgraded to next 14 and mantine 7
5 changes: 5 additions & 0 deletions .changeset/seven-timers-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': minor
---

refactored layouts to match recommended layouts file structure by next docs 13
5 changes: 5 additions & 0 deletions .changeset/smooth-llamas-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': minor
---

Added storybook component stories
5 changes: 5 additions & 0 deletions .changeset/soft-wolves-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': patch
---

refactored 404 and 500 pages because they are ootb & designated special pages by nextjs
5 changes: 5 additions & 0 deletions .changeset/tender-timers-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': patch
---

finished app layout migrations
5 changes: 5 additions & 0 deletions .changeset/yellow-radios-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'analytics-dashboard': minor
---

setup next-auth & added auth0 provicder
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
18 changes: 10 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Workflow name
name: 'Chromatic Deployment'

# Event for the workflow
on:
push:
branches: [master]
pull_request:
branches: [master]

# List of jobs
jobs:
test:
# Operating System
runs-on: ubuntu-latest
# Job steps
steps:
- uses: actions/checkout@v3
- run: yarn
#👇 Adds Chromatic as a step in the workflow
- uses: chromaui/action@v1
# Options required for Chromatic's GitHub Action
with:
#👇 Chromatic projectToken, see https://storybook.js.org/tutorials/intro-to-storybook/react/en/deploy/ to obtain it
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
- name: Create Release Pull Request
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,28 @@ yarn-error.log*
next-env.d.ts

.idea

### StorybookJs ###
# gitignore template for the Storybook, UI guide for front apps
# website: https://storybook.js.org/

storybook-static/

### yarn ###
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored

.yarn/*
!.yarn/releases
!.yarn/patches
!.yarn/plugins
!.yarn/sdks
!.yarn/versions

# if you are NOT using Zero-installs, then:
# comment the following lines
!.yarn/cache

# and uncomment the following lines
# .pnp.*

# End of https://www.toptal.com/developers/gitignore/api/yarn
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm test
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts:
build
coverage
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": true,
"singleQuote": true
}
41 changes: 41 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import type { StorybookConfig } from '@storybook/nextjs';
import { resolve } from 'node:path';
import path from 'path';

const config: StorybookConfig = {
stories: [
'../stories/**/*.mdx',
'../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)',
'../components/**/*.stories.mdx',
'../components/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
'@storybook/addon-styling-webpack',
],
framework: {
name: '@storybook/nextjs',
options: {
nextConfigPath: resolve(__dirname, '../../next.config.js'),
},
},
docs: {
autodocs: 'tag',
},
webpackFinal: async (config, { configType }) => {
if (!config.resolve) {
return config;
}

config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve(__dirname, '..'),
};

return config;
},
};
export default config;
8 changes: 8 additions & 0 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// .storybook/manager.js

import { addons } from '@storybook/manager-api';
import myTheme from './theme';

addons.setConfig({
theme: myTheme,
});
55 changes: 55 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Import styles of packages that you've installed.
// All packages except `@mantine/hooks` require styles imports
import '@mantine/core/styles.css';
import '@mantine/dates/styles.css';
import '@mantine/tiptap/styles.css';
import '@mantine/carousel/styles.css';
import '@mantine/notifications/styles.css';
import 'mantine-datatable/styles.layer.css';

import React, { useEffect } from 'react';
import { addons } from '@storybook/preview-api';
import { DARK_MODE_EVENT_NAME } from 'storybook-dark-mode';
import { MantineProvider, useMantineColorScheme } from '@mantine/core';
import { themes } from '@storybook/theming';
import { Preview } from '@storybook/react';
// @ts-ignore
import { myTheme } from '../theme';

// theme.ts file from previous step

const channel = addons.getChannel();

function ColorSchemeWrapper({ children }: { children: React.ReactNode }) {
const { setColorScheme } = useMantineColorScheme();
const handleColorScheme = (value: boolean) =>
setColorScheme(value ? 'dark' : 'light');

useEffect(() => {
channel.on(DARK_MODE_EVENT_NAME, handleColorScheme);
return () => channel.off(DARK_MODE_EVENT_NAME, handleColorScheme);
}, [channel]);

return <>{children}</>;
}

export const decorators = [
(renderStory: any) => (
<ColorSchemeWrapper>{renderStory()}</ColorSchemeWrapper>
),
(renderStory: any) => (
<MantineProvider theme={myTheme}>{renderStory()}</MantineProvider>
),
];

const preview: Preview = {
parameters: {
nextjs: {
appDirectory: true,
},
docs: {
theme: themes.normal,
},
},
decorators: decorators,
};
13 changes: 13 additions & 0 deletions .storybook/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// .storybook/YourTheme.js

import { create } from '@storybook/theming/create';

export default create({
base: 'light',
brandTitle: 'Mantine analytics dashboard',
brandUrl: 'https://mantine-analytics-dashboard.netlify.app/',
brandTarget: '_blank',

//
colorPrimary: '#2378c3',
});
Binary file added .yarn/install-state.gz
Binary file not shown.
Loading
Loading