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

Dark mode implementation #167

Merged
merged 30 commits into from Jan 3, 2023
Merged

Dark mode implementation #167

merged 30 commits into from Jan 3, 2023

Conversation

LucianPetri
Copy link
Collaborator

Dark Mode Implementation Details Here: #90

@LucianPetri LucianPetri linked an issue Dec 30, 2022 that may be closed by this pull request
15 tasks
@k-nearest-neighbor
Copy link
Collaborator

This is a great start. There are a few areas that need to be addressed:

  • UI regressions: Changes to light mode theme; Header functionality and appearance
  • UI that isn't incorporated into dark mode yet / well.
  • Aesthetics.

I'm going to go through this PR and highlight these, probably committing.

@fozziethebeat
Copy link
Collaborator

This is a pretty big PR touching a lot of files. Let's hold off merging other react component changes until this is reviewed and we're comfortable with it (or deciding some other resolution strategy).

@AbdBarho
Copy link
Collaborator

I also agree that this is a great start. thank you @LucianPetri.

I would like to propose a strategy for moving forward with this:

Ideally, all dark mode handling should be done either be configuring the theme directly, or by having some conditional styling for the components under /components only. This should also include font-size, shadows, gaps, padding, etc...

Everything under /pages should only care about what is being shown, not its design, by using the aforementioned components.

This should make our work future proof, and changes to the design both easy and global.

I am not sure if browser support is there yet, or if chakra ui supports it, but Container queries sound really promising for paddings margins and such...

@@ -21,12 +21,12 @@ const Home = () => {
content="Conversational AI for everyone. An open source project to create a chat enabled GPT LLM run by LAION and contributors around the world."
/>
</Head>
{session ? (
{false ? (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This debugging hack snuck in to my commit. Will be setting it back to session.

Copy link
Collaborator

@fozziethebeat fozziethebeat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty close to being ready. What's stopping us from handling the merge conflicts and checking it in as is?

}
}

export const containerTheme = defineStyleConfig({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest naming the variable the same as the thing being themed. In this case Container

In the index.ts we can then do

export { default as Container } from "./Container";

This is how Chakra structures their pro themes.

@@ -0,0 +1,29 @@
import { type ThemeConfig, extendTheme } from "@chakra-ui/react";
import { containerTheme } from "./components/Container";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than import each components theme here can we create a website/src/styles/Theme/components/index.ts file.

With that we can simplify this as

import * as components from "./components";

And then down below we don't need to define a const components = { ...}. We can just use the import

@fozziethebeat
Copy link
Collaborator

I took a look at this branch. I think we should just check this in as is and then revise the small UI issues in later (tinier) PRs.

The key things to fix before approval:

  • Fix the merge the conflicts above
  • Make sure the action boxes in tasks all are visible. Right now rank_assistant_replies is visible and looks great. The others done (i'm guessing because of how that box is styled). I think the fix is as simple as copy whatever is done in rank_assistant_replies to the other tasks.

@k-nearest-neighbor
Copy link
Collaborator

k-nearest-neighbor commented Jan 2, 2023

The UI and implementation issues actually aren't minor. The implementation uses Container to provide the theme. The purpose of Container is to constrain width, not to provide theme, so it's a problematic mixing of concerns, and adds a lot of unneeded wrappers everywhere. Chakra Container also has a bug where it imparts padding which is impossible to fully remove. See:

chakra-ui/chakra-ui#6905
chakra-ui/chakra-ui#6028 (comment)

On top of that, there are UI regressions in the light theme home page, and header, and the dark theme is broken / not implemented for the grading pages. So the dark theme needs a lot of work.

We should have a typical merge policy where merges must:

  • Not have regressions (UI or otherwise)
  • Be "done" wherever possible
  • i.e., no breaking trunk

I have fixes for these things though. I think this should be ready to merge in a few hours (dinnertime now 🍲). Currently working on:

  • implementation that doesn't use Chakra Container to provide the theme
  • icon toggle
  • header fixes
  • Some styles
  • rebase to fix merge conflicts

…onent, which is for contianing width (and buggy). Last commit before pulling in latest to resolve merge confilicts, and continue to fix the survey pages.
@k-nearest-neighbor
Copy link
Collaborator

Alright. All checks passing and ready.

Copy link
Collaborator

@fozziethebeat fozziethebeat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to finally get this in.

I'll make some small targeted fixes for things in a follow up PR

@fozziethebeat fozziethebeat merged commit a926703 into main Jan 3, 2023
@fozziethebeat fozziethebeat deleted the dark-mode-implementation branch January 3, 2023 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UI/UX All website Components website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement dark mode on website
4 participants