TheMBeat / dungeon-revealer

A web app for tabletop gaming to allow the game master to reveal areas of the game map to players, roll dice and take notes.
ISC License
0 stars 1 forks source link

Sweep (slow): Add a Darkmode with Togglebutton to the ui usung typescript #27

Open TheMBeat opened 11 months ago

TheMBeat commented 11 months ago

Details

Features: Add a Darkmode to the Ui in typescript.

Checklist - [X] Create `src/context/ThemeContext.tsx` ✓ https://github.com/TheMBeat/dungeon-revealer/commit/bee1eb97f876ba7801e0e5e8cca7f1e221b51623 [Edit](https://github.com/TheMBeat/dungeon-revealer/edit/sweep/add_a_darkmode_with_togglebutton_to_the/src/context/ThemeContext.tsx) - [X] Running GitHub Actions for `src/context/ThemeContext.tsx` ✓ [Edit](https://github.com/TheMBeat/dungeon-revealer/edit/sweep/add_a_darkmode_with_togglebutton_to_the/src/context/ThemeContext.tsx) - [X] Create `src/components/ThemeToggleButton.tsx` ✓ https://github.com/TheMBeat/dungeon-revealer/commit/e70ba285f4d09739e17a36ea9b51e64ace681ea1 [Edit](https://github.com/TheMBeat/dungeon-revealer/edit/sweep/add_a_darkmode_with_togglebutton_to_the/src/components/ThemeToggleButton.tsx) - [X] Running GitHub Actions for `src/components/ThemeToggleButton.tsx` ✓ [Edit](https://github.com/TheMBeat/dungeon-revealer/edit/sweep/add_a_darkmode_with_togglebutton_to_the/src/components/ThemeToggleButton.tsx) - [X] Modify `src/hooks/use-persisted-state.ts` ✓ https://github.com/TheMBeat/dungeon-revealer/commit/458b8975b8f69ff00e312ac809a23fa0296d70a4 [Edit](https://github.com/TheMBeat/dungeon-revealer/edit/sweep/add_a_darkmode_with_togglebutton_to_the/src/hooks/use-persisted-state.ts#L11-L25) - [X] Running GitHub Actions for `src/hooks/use-persisted-state.ts` ✓ [Edit](https://github.com/TheMBeat/dungeon-revealer/edit/sweep/add_a_darkmode_with_togglebutton_to_the/src/hooks/use-persisted-state.ts#L11-L25) - [X] Create `src/App.tsx` ✓ https://github.com/TheMBeat/dungeon-revealer/commit/0128f80a88bb1b13f50d34ddb8c67e85c37791a7 [Edit](https://github.com/TheMBeat/dungeon-revealer/edit/sweep/add_a_darkmode_with_togglebutton_to_the/src/App.tsx#L1-L10) - [X] Running GitHub Actions for `src/App.tsx` ✓ [Edit](https://github.com/TheMBeat/dungeon-revealer/edit/sweep/add_a_darkmode_with_togglebutton_to_the/src/App.tsx#L1-L10)
sweep-ai[bot] commented 11 months ago

🚀 Here's the PR! #46

See Sweep's progress at the progress dashboard!
Sweep Basic Tier: I'm using GPT-4. You have 4 GPT-4 tickets left for the month and 2 for the day. (tracking ID: 60bc155fc8)

For more GPT-4 tickets, visit our payment portal. For a one week free trial, try Sweep Pro (unlimited GPT-4 tickets).

[!TIP] I can email you next time I complete a pull request if you set up your email here!


Actions (click)

GitHub Actions✓

Here are the GitHub Actions logs prior to making any changes:

Sandbox logs for a8cdc1d
Checking src/hooks/use-persisted-state.ts for syntax errors... ✅ src/hooks/use-persisted-state.ts has no syntax errors! 1/1 ✓
Checking src/hooks/use-persisted-state.ts for syntax errors...
✅ src/hooks/use-persisted-state.ts has no syntax errors!

Sandbox passed on the latest master, so sandbox checks will be enabled for this issue.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/TheMBeat/dungeon-revealer/blob/a8cdc1dee549b49dc321d8fb4e6c9e889c8fa148/src/hooks/use-invoke-on-scroll-end.ts#L1-L16 https://github.com/TheMBeat/dungeon-revealer/blob/a8cdc1dee549b49dc321d8fb4e6c9e889c8fa148/src/hooks/use-persisted-state.ts#L1-L26 https://github.com/TheMBeat/dungeon-revealer/blob/a8cdc1dee549b49dc321d8fb4e6c9e889c8fa148/src/hooks/use-window-dimensions.tsx#L1-L22 https://github.com/TheMBeat/dungeon-revealer/blob/a8cdc1dee549b49dc321d8fb4e6c9e889c8fa148/src/hooks/use-on-click-outside.tsx#L1-L33

Step 2: ⌨️ Coding

Ran GitHub Actions for bee1eb97f876ba7801e0e5e8cca7f1e221b51623:
• build (macos-latest, 16.x):
• build (windows-latest, 16.x):
• build (ubuntu-latest, 16.x):
• docker:

Ran GitHub Actions for e70ba285f4d09739e17a36ea9b51e64ace681ea1:
• build (macos-latest, 16.x):
• build (windows-latest, 16.x):
• build (ubuntu-latest, 16.x):
• docker:

--- 
+++ 
@@ -11,7 +11,10 @@
 ) => {
   const [value, setValue] = React.useState(() => {
     const rawValue = window.localStorage.getItem(name);
-    return model.decode(rawValue);
+    if (rawValue === null) {
+      return model.decode(undefined);
+    }
+    return rawValue !== null ? model.decode(rawValue) : model.decode(undefined);
   });

   const isFirstRunRef = React.useRef(true);

Ran GitHub Actions for 458b8975b8f69ff00e312ac809a23fa0296d70a4:
• build (macos-latest, 16.x):
• build (windows-latest, 16.x):
• build (ubuntu-latest, 16.x):
• docker:

Ran GitHub Actions for 0128f80a88bb1b13f50d34ddb8c67e85c37791a7:
• build (macos-latest, 16.x):
• build (windows-latest, 16.x):
• build (ubuntu-latest, 16.x):
• docker:


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/add_a_darkmode_with_togglebutton_to_the.


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.Something wrong? Let us know.

This is an automated message generated by Sweep AI.