-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from brunotot/bump-mui-to-v6
chore: bump mui to v6
- Loading branch information
Showing
21 changed files
with
607 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
12 changes: 5 additions & 7 deletions
12
packages/app-vite-react/src/components/inputs/InputThemeToggle/InputThemeToggle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
import { DarkMode, LightMode } from "@mui/icons-material"; | ||
import { IconButton, Tooltip } from "@mui/material"; | ||
import { useColorScheme } from "@mui/material/styles"; | ||
import { sigThemeOpts } from "@org/app-vite-react/signals/sigTheme"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
export function InputThemeToggle() { | ||
const { t } = useTranslation(); | ||
const { mode, setMode } = useColorScheme(); | ||
const isDarkMode = mode === "dark"; | ||
|
||
const isDarkMode = !!sigThemeOpts.value?.dark; | ||
|
||
const handleToggle = () => { | ||
setMode(mode === "dark" ? "light" : "dark"); | ||
sigThemeOpts.value = { dark: !isDarkMode }; | ||
}; | ||
|
||
return ( | ||
<Tooltip title={isDarkMode ? t("setDarkMode") : t("setLightMode")}> | ||
<IconButton onClick={handleToggle}> | ||
{isDarkMode ? <DarkMode /> : <LightMode />} | ||
</IconButton> | ||
<IconButton onClick={handleToggle}>{isDarkMode ? <DarkMode /> : <LightMode />}</IconButton> | ||
</Tooltip> | ||
); | ||
} |
42 changes: 42 additions & 0 deletions
42
packages/app-vite-react/src/components/providers/impl/KeycloakAuthProvider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { StrictMode, type PropsWithChildren } from "react"; | ||
import { ReactKeycloakProvider, useKeycloak } from "@react-keycloak/web"; | ||
import { keycloakClient } from "@org/app-vite-react/setup/keycloakClient.setup"; | ||
import { decodeUserData, sigUser } from "@org/app-vite-react/signals/sigUser"; | ||
import { sigToken } from "@org/app-vite-react/signals/sigToken"; | ||
import { sigKeycloak } from "@org/app-vite-react/signals/sigKeycloak"; | ||
|
||
const KeycloakAuthContent = ({ children }: PropsWithChildren) => { | ||
const { keycloak, initialized } = useKeycloak(); | ||
|
||
if (!initialized) { | ||
return <div>Loading...</div>; | ||
} | ||
|
||
if (!keycloak.authenticated) { | ||
return <div>Not authenticated</div>; | ||
} | ||
|
||
sigKeycloak.value = keycloak; | ||
return <>{children}</>; | ||
}; | ||
|
||
export function KeycloakAuthProvider({ children }: PropsWithChildren) { | ||
return ( | ||
<ReactKeycloakProvider | ||
initOptions={{ onLoad: "login-required" }} | ||
authClient={keycloakClient} | ||
onTokens={({ token }) => { | ||
if (!token) { | ||
console.error("No token received from Keycloak"); | ||
return; | ||
} | ||
sigToken.value = token; | ||
sigUser.value = decodeUserData(token); | ||
}} | ||
> | ||
<KeycloakAuthContent> | ||
<StrictMode>{children}</StrictMode> | ||
</KeycloakAuthContent> | ||
</ReactKeycloakProvider> | ||
); | ||
} |
Oops, something went wrong.