Skip to content

Commit aeef7e3

Browse files
committed
chore: add tinycolor2 and fix dynamic headers() issue with cached server actions
1 parent 6dc9a87 commit aeef7e3

File tree

9 files changed

+78
-80
lines changed

9 files changed

+78
-80
lines changed

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
},
3535
"dependencies": {
3636
"@ark-ui/react": "^2.1.1",
37-
"@auth/core": "^0.27.0",
38-
"@auth/drizzle-adapter": "^0.7.0",
39-
"@neondatabase/serverless": "^0.8.1",
37+
"@auth/core": "^0.28.0",
38+
"@auth/drizzle-adapter": "^0.8.0",
39+
"@neondatabase/serverless": "^0.9.0",
4040
"@next/bundle-analyzer": "^14.1.1-canary.55",
4141
"@react-aria/datepicker": "^3.9.2",
4242
"@react-aria/i18n": "^3.10.1",
@@ -48,20 +48,21 @@
4848
"@tiptap/starter-kit": "^2.2.3",
4949
"@vercel/analytics": "^1.1.4",
5050
"@vercel/speed-insights": "^1.0.10",
51-
"dotenv": "^16.4.4",
52-
"drizzle-orm": "^0.29.3",
51+
"dotenv": "^16.4.5",
52+
"drizzle-orm": "^0.29.5",
5353
"drizzle-valibot": "^0.1.1",
5454
"jsdom": "^24.0.0",
5555
"lucide-react": "^0.331.0",
5656
"luxon": "^3.4.4",
5757
"next": "^14.1.1-canary.55",
58-
"next-auth": "^5.0.0-beta.11",
58+
"next-auth": "^5.0.0-beta.15",
5959
"next-themes": "^0.2.1",
6060
"pg": "^8.11.3",
6161
"react": "^18.2.0",
6262
"react-dom": "^18.2.0",
6363
"server-only": "^0.0.1",
6464
"sqids": "^0.3.0",
65+
"tinycolor2": "^1.6.0",
6566
"valibot": "^0.28.1"
6667
},
6768
"devDependencies": {
@@ -77,13 +78,14 @@
7778
"@types/pg": "^8.11.0",
7879
"@types/react": "^18.2.55",
7980
"@types/react-dom": "^18.2.19",
81+
"@types/tinycolor2": "^1",
8082
"@typescript-eslint/eslint-plugin": "^7.0.1",
8183
"@typescript-eslint/parser": "^7.0.1",
8284
"@typescript-eslint/utils": "^7.0.1",
8385
"cross-env": "^7.0.3",
8486
"drizzle-kit": "^0.20.14",
8587
"eslint": "^8.56.0",
86-
"eslint-config-next": "14.1.0",
88+
"eslint-config-next": "14.1.3",
8789
"eslint-plugin-drizzle": "^0.2.3",
8890
"eslint-plugin-tsdoc": "^0.2.17",
8991
"husky": "^9.0.11",

src/actions/auth.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,4 @@ export const signInAction = async () => {
1414
await signIn(undefined, { redirectTo: SIGN_IN_REDIRECT });
1515
};
1616

17-
export const signOutAction = async () => {
18-
await signOut({ redirectTo: SIGN_OUT_REDIRECT });
19-
};
17+
export const signOutAction = async () => signOut({ redirectTo: SIGN_OUT_REDIRECT });

src/actions/subject.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
import { db } from "@/lib/db/drizzle";
44

5-
export const fetchSubjects = async (search: string) => {
6-
return await db.query.subjects.findMany({
5+
export const fetchSubjects = async (search: string) =>
6+
db.query.subjects.findMany({
77
where: (s, { ilike }) => ilike(s.name, `${search}%`),
88
});
9-
};

src/actions/user.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import type { User } from "@/interfaces/database";
77
import { auth } from "@/lib/auth/config";
88
import { db } from "@/lib/db/drizzle";
99

10-
export const getUser = cache(async (): Promise<User> => {
11-
const session = await auth();
10+
const authSession = auth();
1211

12+
export const getUser = cache(async (): Promise<User> => {
13+
const session = await authSession;
1314
if (!session || !session.user || !session.user.id) notFound();
1415

1516
const { id: userId } = session.user;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
export { GET, POST } from "@/lib/auth/config";
2+
3+
export const runtime = "edge";

src/components/calendar/CalendarEvent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { DateTime, WeekdayNumbers } from "luxon";
2+
import tinycolor from "tinycolor2";
23

34
import { Text } from "@/components/ui";
45
import type { Event } from "@/interfaces/time";
56
import { Flex, GridItem } from "@/lib/styled/jsx";
6-
import { hexToRgb, rgbToYIQ } from "@/utils/colors";
77
import { getPercentage } from "@/utils/common";
88
import { getWeekdayOffset } from "@/utils/time";
99

@@ -35,7 +35,7 @@ export const CalendarEvent = ({
3535
pos="relative"
3636
justify="center"
3737
rounded="l1"
38-
color={rgbToYIQ(hexToRgb(color)) >= 128 ? "black" : "white"}
38+
color={tinycolor.isReadable(color, "white") ? "white" : "black"}
3939
style={{
4040
height: getPercentage(interval.length("hour"), duration),
4141
top: getPercentage(offset, duration),

src/utils/colors.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/utils/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { IconProps } from "@/components/misc";
22

33
type NavItem = {
44
label: string;
5-
href: string;
5+
href: `/${string}`;
66
icon: IconProps["name"];
77
};
88

yarn.lock

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ __metadata:
155155
languageName: node
156156
linkType: hard
157157

158-
"@auth/core@npm:0.27.0, @auth/core@npm:^0.27.0":
159-
version: 0.27.0
160-
resolution: "@auth/core@npm:0.27.0"
158+
"@auth/core@npm:0.28.0, @auth/core@npm:^0.28.0":
159+
version: 0.28.0
160+
resolution: "@auth/core@npm:0.28.0"
161161
dependencies:
162162
"@panva/hkdf": "npm:^1.1.1"
163163
"@types/cookie": "npm:0.6.0"
@@ -177,16 +177,16 @@ __metadata:
177177
optional: true
178178
nodemailer:
179179
optional: true
180-
checksum: 10c0/66862fa96d68435500b71eb16afc2639d9eb2fb6c40a477e984df6606ae2b6e05d2d3eeca3ea48a289adea7586ee81a680a3b26ba7f0cd90f63e17a90e997bf6
180+
checksum: 10c0/098431a4b7eda2cf7d1159de930f9e2185978476b28d43172fcd5607109f33d85474d87c3e8b7a88c6536f38d95949d52e6666ebba8fdefcfae59c849481f7aa
181181
languageName: node
182182
linkType: hard
183183

184-
"@auth/drizzle-adapter@npm:^0.7.0":
185-
version: 0.7.0
186-
resolution: "@auth/drizzle-adapter@npm:0.7.0"
184+
"@auth/drizzle-adapter@npm:^0.8.0":
185+
version: 0.8.0
186+
resolution: "@auth/drizzle-adapter@npm:0.8.0"
187187
dependencies:
188-
"@auth/core": "npm:0.27.0"
189-
checksum: 10c0/82e6448e83790758f2022f4a7f0221b8c6a75c395ee4670fb67fb4a70a92b96effb6fc43a18d72f8881b52846949a5310c58b8694cd1898c6a501c7b3b6a2b01
188+
"@auth/core": "npm:0.28.0"
189+
checksum: 10c0/77b9a414fc47b79045a87486a30752263a68fab42dcdb5c56dd11a60f8e746feb166d1655c667578fe7c439bc93bd09a60d21de4b1556ec83d58ea6fa2dea04c
190190
languageName: node
191191
linkType: hard
192192

@@ -1424,12 +1424,12 @@ __metadata:
14241424
languageName: node
14251425
linkType: hard
14261426

1427-
"@neondatabase/serverless@npm:^0.8.1":
1428-
version: 0.8.1
1429-
resolution: "@neondatabase/serverless@npm:0.8.1"
1427+
"@neondatabase/serverless@npm:^0.9.0":
1428+
version: 0.9.0
1429+
resolution: "@neondatabase/serverless@npm:0.9.0"
14301430
dependencies:
14311431
"@types/pg": "npm:8.6.6"
1432-
checksum: 10c0/70df6a0a300f83d445a7b10410916d0201cfdb7a54e5b528404e8b6d7ccf5bbc760b297fbb782cdf852789470e7c209fbb1cb3b95fed3f449207ca4a3f17edbd
1432+
checksum: 10c0/acddf16d414e8991b0a71785e61ea5bf484c7cb88af12177fd8e124e41cd180b8e676e3228f7bfe2146453e9323d50aca88731d4a8d5db4e974f9aa80989a4b7
14331433
languageName: node
14341434
linkType: hard
14351435

@@ -1449,12 +1449,12 @@ __metadata:
14491449
languageName: node
14501450
linkType: hard
14511451

1452-
"@next/eslint-plugin-next@npm:14.1.0":
1453-
version: 14.1.0
1454-
resolution: "@next/eslint-plugin-next@npm:14.1.0"
1452+
"@next/eslint-plugin-next@npm:14.1.3":
1453+
version: 14.1.3
1454+
resolution: "@next/eslint-plugin-next@npm:14.1.3"
14551455
dependencies:
14561456
glob: "npm:10.3.10"
1457-
checksum: 10c0/d8753d8258bef471ba1296f760b092c0a17e89ddc937bf16b9399725d05b6426e58e3c8eb4efb8e8f027025804ecea3b714a7b7c75682d019e53ea8d181b8632
1457+
checksum: 10c0/08ac68dad1866c2ec8662b852fcf224fd45a15cc9e6033b3f017760c0b0a1a04e663adf3ab86b2d34b0e89189b7d2cf4226a2769e0ee39bd9405443bb185adb8
14581458
languageName: node
14591459
linkType: hard
14601460

@@ -2927,6 +2927,13 @@ __metadata:
29272927
languageName: node
29282928
linkType: hard
29292929

2930+
"@types/tinycolor2@npm:^1":
2931+
version: 1.4.6
2932+
resolution: "@types/tinycolor2@npm:1.4.6"
2933+
checksum: 10c0/922020c3326460e9d8502c8a98f80db69f06fd14e07fe5a48e8ffe66175762298a9bd51263f2a0c9a40632886a74975a3ff79396defcdbeac0dc176e3e5056e8
2934+
languageName: node
2935+
linkType: hard
2936+
29302937
"@types/tough-cookie@npm:*":
29312938
version: 4.0.5
29322939
resolution: "@types/tough-cookie@npm:4.0.5"
@@ -6466,10 +6473,10 @@ __metadata:
64666473
languageName: node
64676474
linkType: hard
64686475

6469-
"dotenv@npm:^16.4.4":
6470-
version: 16.4.4
6471-
resolution: "dotenv@npm:16.4.4"
6472-
checksum: 10c0/f66ad105144c9106a868c8e244ace6097a0318f63284894e6c7b298c7e096911958837117d936d3c341db550e2fcb21a7a5ad396437638f605460e82b1dd30ee
6476+
"dotenv@npm:^16.4.5":
6477+
version: 16.4.5
6478+
resolution: "dotenv@npm:16.4.5"
6479+
checksum: 10c0/48d92870076832af0418b13acd6e5a5a3e83bb00df690d9812e94b24aff62b88ade955ac99a05501305b8dc8f1b0ee7638b18493deb6fe93d680e5220936292f
64736480
languageName: node
64746481
linkType: hard
64756482

@@ -6506,9 +6513,9 @@ __metadata:
65066513
languageName: node
65076514
linkType: hard
65086515

6509-
"drizzle-orm@npm:^0.29.3":
6510-
version: 0.29.3
6511-
resolution: "drizzle-orm@npm:0.29.3"
6516+
"drizzle-orm@npm:^0.29.5":
6517+
version: 0.29.5
6518+
resolution: "drizzle-orm@npm:0.29.5"
65126519
peerDependencies:
65136520
"@aws-sdk/client-rds-data": ">=3"
65146521
"@cloudflare/workers-types": ">=3"
@@ -6577,7 +6584,7 @@ __metadata:
65776584
optional: true
65786585
sqlite3:
65796586
optional: true
6580-
checksum: 10c0/a5a53e4599981f256e10bd0e6e4724f14ffe7c9f6bef963c5cc9d00c8379c2367324ae0c67abc52a319704fedba796a5583dac3d36fac0de19585f87844d3611
6587+
checksum: 10c0/187771340951bb154d2e101a4ffa288dd2d127fecc12ebfd494170076121b73456b9fd13b5a0b69ffcce388d288e664b1c9347d7fb5f4ee64894be2a2429d885
65816588
languageName: node
65826589
linkType: hard
65836590

@@ -7179,11 +7186,11 @@ __metadata:
71797186
languageName: node
71807187
linkType: hard
71817188

7182-
"eslint-config-next@npm:14.1.0":
7183-
version: 14.1.0
7184-
resolution: "eslint-config-next@npm:14.1.0"
7189+
"eslint-config-next@npm:14.1.3":
7190+
version: 14.1.3
7191+
resolution: "eslint-config-next@npm:14.1.3"
71857192
dependencies:
7186-
"@next/eslint-plugin-next": "npm:14.1.0"
7193+
"@next/eslint-plugin-next": "npm:14.1.3"
71877194
"@rushstack/eslint-patch": "npm:^1.3.3"
71887195
"@typescript-eslint/parser": "npm:^5.4.2 || ^6.0.0"
71897196
eslint-import-resolver-node: "npm:^0.3.6"
@@ -7198,7 +7205,7 @@ __metadata:
71987205
peerDependenciesMeta:
71997206
typescript:
72007207
optional: true
7201-
checksum: 10c0/8e3fc5fb99d8d8d03651a44487bd7739fd880cf6698292f548ebdb3886c52b3030758018970401f6220430e7d003a1100a62de47f86f7216d3c86ba0e1cd9cd1
7208+
checksum: 10c0/4ab843af53cebf38b5e280597b94582b5cc4afc91dc04e6a70ed9c333cd0ebf4e8ae8ac16d77992e2c1557754cbd0f5460f5a858db62b83db4837d84638ac524
72027209
languageName: node
72037210
linkType: hard
72047211

@@ -8165,10 +8172,10 @@ __metadata:
81658172
resolution: "inkhorn@workspace:."
81668173
dependencies:
81678174
"@ark-ui/react": "npm:^2.1.1"
8168-
"@auth/core": "npm:^0.27.0"
8169-
"@auth/drizzle-adapter": "npm:^0.7.0"
8175+
"@auth/core": "npm:^0.28.0"
8176+
"@auth/drizzle-adapter": "npm:^0.8.0"
81708177
"@ianvs/prettier-plugin-sort-imports": "npm:^4.1.1"
8171-
"@neondatabase/serverless": "npm:^0.8.1"
8178+
"@neondatabase/serverless": "npm:^0.9.0"
81728179
"@next/bundle-analyzer": "npm:^14.1.1-canary.55"
81738180
"@pandacss/dev": "npm:^0.31.0"
81748181
"@pandacss/eslint-plugin": "npm:^0.0.17"
@@ -8189,18 +8196,19 @@ __metadata:
81898196
"@types/pg": "npm:^8.11.0"
81908197
"@types/react": "npm:^18.2.55"
81918198
"@types/react-dom": "npm:^18.2.19"
8199+
"@types/tinycolor2": "npm:^1"
81928200
"@typescript-eslint/eslint-plugin": "npm:^7.0.1"
81938201
"@typescript-eslint/parser": "npm:^7.0.1"
81948202
"@typescript-eslint/utils": "npm:^7.0.1"
81958203
"@vercel/analytics": "npm:^1.1.4"
81968204
"@vercel/speed-insights": "npm:^1.0.10"
81978205
cross-env: "npm:^7.0.3"
8198-
dotenv: "npm:^16.4.4"
8206+
dotenv: "npm:^16.4.5"
81998207
drizzle-kit: "npm:^0.20.14"
8200-
drizzle-orm: "npm:^0.29.3"
8208+
drizzle-orm: "npm:^0.29.5"
82018209
drizzle-valibot: "npm:^0.1.1"
82028210
eslint: "npm:^8.56.0"
8203-
eslint-config-next: "npm:14.1.0"
8211+
eslint-config-next: "npm:14.1.3"
82048212
eslint-plugin-drizzle: "npm:^0.2.3"
82058213
eslint-plugin-tsdoc: "npm:^0.2.17"
82068214
husky: "npm:^9.0.11"
@@ -8209,7 +8217,7 @@ __metadata:
82098217
lucide-react: "npm:^0.331.0"
82108218
luxon: "npm:^3.4.4"
82118219
next: "npm:^14.1.1-canary.55"
8212-
next-auth: "npm:^5.0.0-beta.11"
8220+
next-auth: "npm:^5.0.0-beta.15"
82138221
next-themes: "npm:^0.2.1"
82148222
pg: "npm:^8.11.3"
82158223
postcss: "npm:^8.4.35"
@@ -8218,6 +8226,7 @@ __metadata:
82188226
react-dom: "npm:^18.2.0"
82198227
server-only: "npm:^0.0.1"
82208228
sqids: "npm:^0.3.0"
8229+
tinycolor2: "npm:^1.6.0"
82218230
tsx: "npm:^4.7.1"
82228231
typescript: "npm:^5.3.3"
82238232
valibot: "npm:^0.28.1"
@@ -9505,11 +9514,11 @@ __metadata:
95059514
languageName: node
95069515
linkType: hard
95079516

9508-
"next-auth@npm:^5.0.0-beta.11":
9509-
version: 5.0.0-beta.11
9510-
resolution: "next-auth@npm:5.0.0-beta.11"
9517+
"next-auth@npm:^5.0.0-beta.15":
9518+
version: 5.0.0-beta.15
9519+
resolution: "next-auth@npm:5.0.0-beta.15"
95119520
dependencies:
9512-
"@auth/core": "npm:0.27.0"
9521+
"@auth/core": "npm:0.28.0"
95139522
peerDependencies:
95149523
"@simplewebauthn/browser": ^9.0.1
95159524
"@simplewebauthn/server": ^9.0.2
@@ -9523,7 +9532,7 @@ __metadata:
95239532
optional: true
95249533
nodemailer:
95259534
optional: true
9526-
checksum: 10c0/9bb7905f5da7073ce1d28f391ac30977b204e01d634b75aac3d8a4b9267f4f14a413af99c9d8cdc6bdef95a0184dfe5be77d52d96c75931c8229a7540b865733
9535+
checksum: 10c0/518e88bfd8fd74040e3fe15268c7e33f8ad11c421b659a452787c178aad60a4caa555ff35e65504f58e3088704698834bb5a257e952cf35cfef7e3beb7dd2f71
95279536
languageName: node
95289537
linkType: hard
95299538

@@ -11436,6 +11445,13 @@ __metadata:
1143611445
languageName: node
1143711446
linkType: hard
1143811447

11448+
"tinycolor2@npm:^1.6.0":
11449+
version: 1.6.0
11450+
resolution: "tinycolor2@npm:1.6.0"
11451+
checksum: 10c0/9aa79a36ba2c2a87cb221453465cabacd04b9e35f9694373e846fdc78b1c768110f81e581ea41440106c0f24d9a023891d0887e8075885e790ac40eb0e74a5c1
11452+
languageName: node
11453+
linkType: hard
11454+
1143911455
"tippy.js@npm:^6.3.7":
1144011456
version: 6.3.7
1144111457
resolution: "tippy.js@npm:6.3.7"

0 commit comments

Comments
 (0)