From 8a8955ff08dbdeec656ca39b7c2c13ca21906f4c Mon Sep 17 00:00:00 2001 From: Spencer Spenst Date: Wed, 4 Oct 2023 15:50:29 -0700 Subject: [PATCH] next-themes (#1004) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * next-themes wip * signup toast and game.tsx change * nuke newrelic frontend because possible memory issue on windows * update git ignore, add public/sounds/music * /campaign perf. From ~1.1s load to about 200ms * fix test * cleanup * reset leastMoves on unpublish * post level modal and tooltips (#1000) * post level modal and tooltips * wip * revert collection-by-id * updates * delete capitalized file * PR todos done * cleanup * fix build * useeffect for query params * tweaks * simplify --------- Co-authored-by: Spencer Spenst * ch4 preview (#1006) * collection-by-id aggregate (#1003) * wip * fix issue with collection ordering * fix test * improve getCollection across website * improving agg for edit levels * rename * improve profile collections loading by ~25% * fix some issues with getCollections * fix tests * fix bug found from broken test. * knock another 100ms off profile load * 👍 * forgot 1 file --------- Co-authored-by: Danny Miller * postgamemodal improvements * more intuitive campaign button * login link for some tips * [Snyk] Upgrade pureimage from 0.3.17 to 0.4.7 (#977) * fix: upgrade pureimage from 0.3.17 to 0.4.7 Snyk has created this PR to upgrade pureimage from 0.3.17 to 0.4.7. See this package in npm: https://www.npmjs.com/package/pureimage See this project in Snyk: https://app.snyk.io/org/k2xl/project/cf09253a-8e4c-4f7f-b75f-a1763e5c78eb?utm_source=github&utm_medium=referral&page=upgrade-pr * pureimage type declaration * fix --------- Co-authored-by: snyk-bot Co-authored-by: Spencer Spenst * add reviews and 'dont show this popup for 24h' checkbox * getRecommendedLevel dont show a level they have played recently * get rid of datetime filter * Tweak. Remove unnecessary colon * complete/incomplete filter button for chapters * indicators for marking ready * tooltip for checkpoint * cleanup * disable useswr unless popup is open * share icons on post modal * sharebar * curator edit/delete reviews (#1009) * curator edit/delete reviews * red ellipsis * test * fix flaky tests * merge * clear review rating button * curator level management ux * delete achievements on user delete * use level userId instead of req userId * move add to/edit level out of header dropdown * hotfix for deleted reviews on home page * achievement page (#1005) * i forgot i had made this page on a branch when we did achievements * tweak --------- Co-authored-by: Spencer Spenst * update calc_records on archive * Revert "update calc_records on archive" This reverts commit 06f89c8fa37f1cf0d0b9a59d412316994eb747b7. * Try to get twitter images to show * change to twitter site for card... * apparently twitter now requires full url for og image * also do ogurl just in case * mobile buttons update (#1011) * mobile buttons update * optimizations * mobile tweaks --------- Co-authored-by: Spencer Spenst * integrityCheckRecords * more accurate preventKeyDownEvent * multiSelectLevel (from #1008) * handle app theme in theme modal * use dark class condition instead of checking theme --------- Co-authored-by: Danny Miller Co-authored-by: snyk-bot --- components/homepage/homeLoggedIn.tsx | 9 ++------- components/level/reviews/commentThread.tsx | 10 ++-------- components/level/reviews/commentWall.tsx | 11 ++--------- components/level/reviews/reviewForm.tsx | 9 ++------- components/modal/themeModal.tsx | 7 +++++++ components/settings/settingsPro.tsx | 11 ++--------- package-lock.json | 11 +++++++++++ package.json | 1 + pages/_app.tsx | 7 +++---- tailwind.config.js | 7 ++++--- 10 files changed, 36 insertions(+), 47 deletions(-) diff --git a/components/homepage/homeLoggedIn.tsx b/components/homepage/homeLoggedIn.tsx index 138906fe5..34f251469 100644 --- a/components/homepage/homeLoggedIn.tsx +++ b/components/homepage/homeLoggedIn.tsx @@ -7,7 +7,6 @@ import Image from 'next/image'; import Link from 'next/link'; import { useRouter } from 'next/router'; import React, { useContext, useState } from 'react'; -import Theme from '../../constants/theme'; import TimeRange from '../../constants/timeRange'; import { AppContext } from '../../contexts/appContext'; import { useTour } from '../../hooks/useTour'; @@ -43,15 +42,11 @@ export default function HomeLoggedIn({ topLevelsThisMonth, user, }: HomeLoggedInProps) { - const { multiplayerSocket, theme, userConfig } = useContext(AppContext); + const { multiplayerSocket, userConfig } = useContext(AppContext); const router = useRouter(); const [search, setSearch] = useState(''); const { connectedPlayersCount, matches, socket } = multiplayerSocket; - const buttonClassNames = classNames('py-2.5 px-3.5 inline-flex justify-center items-center gap-2 rounded-md border font-medium align-middle focus:z-10 focus:outline-none focus:ring-2 focus:ring-blue-600 transition-all text-sm whitespace-nowrap', - theme === Theme.Light ? - 'bg-green-100 hover:bg-gray-50 border-gray-300 text-gray-700' : - 'bg-gray-800 hover:bg-slate-600 border-gray-700 text-gray-300' - ); + const buttonClassNames = 'py-2.5 px-3.5 inline-flex justify-center items-center gap-2 rounded-md border font-medium align-middle focus:z-10 focus:outline-none focus:ring-2 focus:ring-blue-600 transition-all text-sm whitespace-nowrap bg-green-100 dark:bg-gray-800 hover:bg-gray-50 hover:dark:bg-slate-600 border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300'; const tour = useTour(PagePath.HOME); diff --git a/components/level/reviews/commentThread.tsx b/components/level/reviews/commentThread.tsx index 30f0b4659..30a3038cb 100644 --- a/components/level/reviews/commentThread.tsx +++ b/components/level/reviews/commentThread.tsx @@ -3,7 +3,6 @@ import { Types } from 'mongoose'; import React, { useContext, useEffect, useRef, useState } from 'react'; import toast from 'react-hot-toast'; import { KeyedMutator } from 'swr'; -import Theme from '../../../constants/theme'; import { AppContext } from '../../../contexts/appContext'; import { COMMENT_QUERY_LIMIT } from '../../../models/CommentEnums'; import { EnrichedComment } from '../../../models/db/comment'; @@ -29,7 +28,7 @@ export default function CommentThread({ className, comment, mutateComments, onSe const [text, setText] = useState(''); const [totalRows, setTotalRows] = useState(comment.totalReplies || 0); const [page, setPage] = useState(0); - const { theme, user } = useContext(AppContext); + const { user } = useContext(AppContext); useEffect(() => { const urlParams = new URLSearchParams(window.location.search); @@ -210,12 +209,7 @@ export default function CommentThread({ className, comment, mutateComments, onSe :