Skip to content

Commit

Permalink
Pass the isDark param when redirecting to the account theme
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej authored and JeromeBu committed Dec 11, 2024
1 parent ac5320b commit 240d05e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions web/src/core/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type ParamsOfBootstrapCore = {
termsOfServiceUrl: LocalizedString<Language>;
}) => string;
getCurrentLang: () => Language;
getIsDark: () => boolean;
onMoved: (params: { redirectUrl: string }) => void;
};

Expand Down
14 changes: 13 additions & 1 deletion web/src/core/usecases/userAccountManagement/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const thunks = {
,
getState,
{
paramsOfBootstrapCore: { getCurrentLang }
paramsOfBootstrapCore: { getCurrentLang, getIsDark }
}
] = args;

Expand Down Expand Up @@ -162,6 +162,18 @@ export const thunks = {
url = newUrl;
}

{

const { newUrl } = addParamToUrl({
url,
"name": "dark",
"value": `${getIsDark()}`
});

url = newUrl;

}

return url;
}
} satisfies Thunks;
6 changes: 5 additions & 1 deletion web/src/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ const { CoreProvider } = createCoreProvider({
);

window.location.href = newUrl.toString();
}
},
// NOTE: Passed so that it can be injected in the Account management URL.
// I'm not comfortable with this level of indirection, this is only UI related logic
// that shouldn't involve the core. However I do it this way for consistency sake.
getIsDark
});

export default function App() {
Expand Down

0 comments on commit 240d05e

Please sign in to comment.