Skip to content

Commit 9f62316

Browse files
fix: dev errors + outdated scss
1 parent 61599b6 commit 9f62316

File tree

6 files changed

+42
-34
lines changed

6 files changed

+42
-34
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "next-app",
33
"private": true,
44
"scripts": {
5-
"dev": "next dev --turbopack",
5+
"dev": "next dev",
66
"build": "next build",
77
"start": "next start",
88
"export": "next export",
@@ -17,8 +17,8 @@
1717
"@vercel/analytics": "^1.3.1",
1818
"chart.js": "^4.4.2",
1919
"chess.ts": "^0.16.2",
20+
"chessground": "^8.3.5",
2021
"chroma-js": "^2.4.2",
21-
"classnames": "^2.3.1",
2222
"exponential-backoff": "^3.1.1",
2323
"framer-motion": "^11.5.6",
2424
"gray-matter": "^4.0.3",

src/hooks/useLocalStorage/useLocalStorage.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export const useLocalStorage = <T>(
66
): [T, (arg0: T) => void] => {
77
const isClient = typeof window !== 'undefined'
88
const [storedValue, setStoredValue] = useState<T>(() => {
9+
if (!isClient) {
10+
return initialValue
11+
}
912
try {
1013
const item = window.localStorage.getItem(key)
1114
return item ? JSON.parse(item) : initialValue
@@ -20,8 +23,9 @@ export const useLocalStorage = <T>(
2023
const valueToStore =
2124
value instanceof Function ? value(storedValue) : value
2225
setStoredValue(valueToStore)
23-
if (isClient)
24-
window?.localStorage?.setItem(key, JSON.stringify(valueToStore))
26+
if (isClient) {
27+
window.localStorage.setItem(key, JSON.stringify(valueToStore))
28+
}
2529
} catch (error) {
2630
console.error(error)
2731
}

src/styles/_base.scss

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
@import './theme';
2-
@import './layout';
1+
@use 'theme';
2+
@use 'layout';
33

44
@mixin rounded {
55
border-radius: 10px;
66
}
77

88
@mixin shadowed {
9-
@include themed-styles {
10-
filter: drop-shadow(0px 2px 8px rgba(themed-colour('background0'), 1));
9+
@include theme.themed-styles {
10+
filter: drop-shadow(0px 2px 8px rgba(theme.themed-colour('background0'), 1));
1111
}
1212
}
1313

1414
@mixin boxed {
1515
@include rounded;
16-
@include themed-styles {
17-
background-color: rgba(themed-colour('background0'), 0.75);
16+
@include theme.themed-styles {
17+
background-color: rgba(theme.themed-colour('background0'), 0.75);
1818
}
1919
}
2020

2121
@mixin scroll {
2222
&::-webkit-scrollbar {
2323
width: 7px;
2424

25-
@include mobile {
25+
@include layout.mobile {
2626
width: 4px;
2727
height: 8px;
2828
}
@@ -36,13 +36,13 @@
3636
border-radius: 1px;
3737
transition: 150ms;
3838

39-
@include themed-styles {
40-
background-color: rgba(themed-colour('human-accent'), 0.4);
39+
@include theme.themed-styles {
40+
background-color: rgba(theme.themed-colour('human-accent'), 0.4);
4141
}
4242

4343
&:hover {
44-
@include themed-styles {
45-
background-color: rgba(themed-colour('human-accent'), 0.65);
44+
@include theme.themed-styles {
45+
background-color: rgba(theme.themed-colour('human-accent'), 0.65);
4646
}
4747
}
4848
}

src/styles/_theme.scss

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
@use 'sass:map';
2+
3+
$theme-map: null !default;
4+
15
$themes: (
26
light: (
37
backdrop: #f6f6f6,
@@ -28,8 +32,8 @@ $themes: (
2832
:global(.theme-#{$theme}) & {
2933
$theme-map: () !global;
3034
@each $key, $submap in $map {
31-
$value: map-get($map, '#{$key}');
32-
$theme-map: map-merge(
35+
$value: map.get($map, '#{$key}');
36+
$theme-map: map.merge(
3337
$theme-map,
3438
(
3539
$key: $value,
@@ -45,8 +49,8 @@ $themes: (
4549
.theme-#{$theme} & {
4650
$theme-map: () !global;
4751
@each $key, $submap in $map {
48-
$value: map-get($map, '#{$key}');
49-
$theme-map: map-merge(
52+
$value: map.get($map, '#{$key}');
53+
$theme-map: map.merge(
5054
$theme-map,
5155
(
5256
$key: $value,
@@ -60,5 +64,5 @@ $themes: (
6064
}
6165

6266
@function themed-colour($key) {
63-
@return map-get($theme-map, $key);
67+
@return map.get($theme-map, $key);
6468
}

src/styles/globals.scss

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@import './theme';
2-
@import './layout';
3-
@import './fonts';
4-
@import './base';
1+
@use 'theme';
2+
@use 'layout';
3+
@use 'fonts';
4+
@use 'base';
55

66
button {
77
&:disabled {
@@ -31,12 +31,12 @@ a {
3131

3232
width: 100%;
3333
min-height: 100vh;
34-
@include themed-styles {
35-
background-color: themed-colour(backdrop);
36-
color: themed-colour(text-primary);
34+
@include theme.themed-styles {
35+
background-color: theme.themed-colour(backdrop);
36+
color: theme.themed-colour(text-primary);
3737
}
3838

39-
@include mobile {
39+
@include layout.mobile {
4040
flex-direction: column;
4141
overflow-x: hidden;
4242
}
@@ -45,7 +45,7 @@ a {
4545
.content-container {
4646
flex-grow: 1;
4747
position: relative;
48-
@include rounded;
48+
@include base.rounded;
4949
display: flex;
5050
flex-direction: column;
5151
}
@@ -65,7 +65,7 @@ h5 {
6565
flex-grow: 1;
6666
margin-left: 2vw;
6767

68-
@include mobile {
68+
@include layout.mobile {
6969
flex-direction: column;
7070
margin-left: 0px;
7171
}
@@ -79,7 +79,7 @@ h5 {
7979
flex-grow: 1;
8080
padding: 2em;
8181

82-
@include mobile {
82+
@include layout.mobile {
8383
width: 100%;
8484
padding: 1em;
8585
max-width: none;
@@ -96,15 +96,15 @@ h5 {
9696
gap: 10px;
9797
margin: 10px;
9898

99-
@include mobile {
99+
@include layout.mobile {
100100
margin: 0px;
101101
width: 100%;
102102
max-width: none;
103103
}
104104
}
105105

106106
.action {
107-
@include boxed;
107+
@include base.boxed;
108108
width: 100%;
109109
padding: 25px;
110110
}

0 commit comments

Comments
 (0)