-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Wire up design settings (theme colour & logo) #2660
Conversation
Removed vultr server and associated DNS entries |
ef44ac5
to
3234a3c
Compare
1cff2e6
to
efa2225
Compare
efa2225
to
caada89
Compare
690e931
to
8a01411
Compare
caada89
to
28b192c
Compare
8a01411
to
15b47a4
Compare
## What does this PR do? - Adds new `team.updateTheme()` method - Implemented in theopensystemslab/planx-new#2660
28b192c
to
958a633
Compare
15b47a4
to
bfa2fc4
Compare
958a633
to
b81cbb5
Compare
useEffect(() => { | ||
setInitialValues({ | ||
primaryColour: team.theme?.primaryColour, | ||
logo: team.theme?.logo, | ||
}) | ||
}, [team]) | ||
|
||
const [initialValues, setInitialValues] = useState<FormValues>({ | ||
primaryColour: "", | ||
logo: "", | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit awkward but was the best way I could get the form to handle async initial values from outside the component. Without this the form reverted to its initial state on reset (even after a successful "Save").
useEffect(() => { | ||
const fetchTeam = async () => { | ||
try { | ||
const fetchedTeam = await useStore.getState().fetchCurrentTeam(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to get the team from the DB as the currently held team in the store does not include the theme. If we fetch the theme initially, it's them live throughout the Editor (e.g. the header changes colour when navigating from team to team).
This could be resolved and simplified, I'll either revist as another PR or open an issue.
<ButtonForm /> | ||
<TextLinkForm /> | ||
<FaviconForm /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ButtonForm, FaviconForm and TextLinkForm are currently still placeholders are will be wired up in follow-up PR sbranched from this one. The current PR is big enough as is!
<ButtonForm /> | ||
<TextLinkForm /> | ||
<FaviconForm /> | ||
<Snackbar open={open} autoHideDuration={6000} onClose={handleClose}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're happy with this approach of using Snackbar
within the Editor for notifications we might want to move this to a higher level and set up a service to call it in various child components as opposed to repeating it in multiple places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Snackbar works really well in this scenario!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great and working as expected for me 👍
What does this PR do?
DesignSettings
component into reusable componentsprimaryColour
in theme, but is implemented throughout the application consistently in feat: Apply theme colours across app #2658SHOW_TEAM_SETTINGS
feature flag still requiredTo test