Skip to content

Commit

Permalink
Remove assetUrl prefix (#1133)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev authored Dec 10, 2024
1 parent f7bf9b2 commit 7cf582a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/keychain/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export function ControllerThemeProvider({
children,
theme = defaultTheme,
}: PropsWithChildren<{ theme?: ControllerTheme }>) {
useThemeEffect({ theme, assetUrl: "" });
useThemeEffect({ theme });
const chakraTheme = useChakraTheme(theme);

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/keychain/src/components/Provider/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { PropsWithChildren, useEffect, useMemo } from "react";
export function ControllerThemeProvider({ children }: PropsWithChildren) {
const { theme } = useConnection();

useThemeEffect({ theme, assetUrl: "" });
useThemeEffect({ theme });
const chakraTheme = useChakraTheme(theme);

return (
Expand Down
1 change: 0 additions & 1 deletion packages/profile/.env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
VITE_CARTRIDGE_API_URL="https://api.cartridge.gg"
VITE_KEYCHAIN_URL="http://localhost:3001"
VITE_RPC_SEPOLIA="https://api.cartridge.gg/x/starknet/sepolia"
VITE_POSTHOG_KEY=phc_UWaJajNQ00PjHhveZ81SJ2zVtBicKrzewdZHGiyavQQ
VITE_POSTHOG_HOST=https://profile.cartridge.gg/ingest
1 change: 0 additions & 1 deletion packages/profile/.env.production
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
VITE_CARTRIDGE_API_URL="https://api.cartridge.gg"
VITE_KEYCHAIN_URL="https://x.cartridge.gg"
VITE_RPC_SEPOLIA="https://api.cartridge.gg/x/starknet/sepolia"
VITE_POSTHOG_KEY=phc_UWaJajNQ00PjHhveZ81SJ2zVtBicKrzewdZHGiyavQQ
VITE_POSTHOG_HOST=https://profile.cartridge.gg/ingest
2 changes: 1 addition & 1 deletion packages/profile/src/components/context/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function ThemeProvider({
setTheme(JSON.parse(val));
}, [themeParam, origin]);

useThemeEffect({ theme, assetUrl: import.meta.env.VITE_KEYCHAIN_URL });
useThemeEffect({ theme });

const value = {
colorScheme,
Expand Down
16 changes: 5 additions & 11 deletions packages/ui-next/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { useEffect } from "react";
import { hexToHsl } from "@cartridge/utils";

export function useThemeEffect({
theme,
assetUrl,
}: {
theme: ControllerTheme;
assetUrl: string;
}) {
export function useThemeEffect({ theme }: { theme: ControllerTheme }) {
useEffect(() => {
if (!theme) return;

Expand All @@ -17,12 +11,12 @@ export function useThemeEffect({

document.documentElement.style.setProperty(
"--theme-icon-url",
`url("${assetUrl}${theme.icon}")`,
`url("${theme.icon}")`,
);
const coverUrl =
typeof theme.cover === "string"
? `url("${assetUrl}${theme.cover}")`
: `url("${assetUrl}${theme.cover[appliedColorMode]}")`;
? `url("${theme.cover}")`
: `url("${theme.cover[appliedColorMode]}")`;
document.documentElement.style.setProperty("--theme-cover-url", coverUrl);

if (!theme.colors) return;
Expand All @@ -45,7 +39,7 @@ export function useThemeEffect({
hexToHsl(val),
);
}
}, [theme, assetUrl]);
}, [theme]);
}

// dup of @cartridge/controller/types
Expand Down

0 comments on commit 7cf582a

Please sign in to comment.