-
Couldn't load subscription status.
- Fork 11
fix: broken colors #1181
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
fix: broken colors #1181
Changes from all commits
ac48835
c196d65
c14fe87
b2f80f3
79e0b02
7d3edc6
2d10a55
a30b14d
d2e9e61
262c39f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,10 +7,12 @@ import AES from 'crypto-js/aes'; | |||||||||||||||||||||||||||||||||||
| import type { SendPayloads } from '~/store/callback'; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| import SsoButtonCe from '~/components/SsoButton.ce.vue'; | ||||||||||||||||||||||||||||||||||||
| import { useThemeStore } from '~/store/theme'; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| const serverStore = useDummyServerStore(); | ||||||||||||||||||||||||||||||||||||
| const { serverState } = storeToRefs(serverStore); | ||||||||||||||||||||||||||||||||||||
| const { registerEntry } = useCustomElements(); | ||||||||||||||||||||||||||||||||||||
| const { theme } = storeToRefs(useThemeStore()); | ||||||||||||||||||||||||||||||||||||
| onBeforeMount(() => { | ||||||||||||||||||||||||||||||||||||
| registerEntry('UnraidComponents'); | ||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||
|
|
@@ -75,6 +77,13 @@ onMounted(() => { | |||||||||||||||||||||||||||||||||||
| 'forUpc' | ||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| const bannerImage = watch(theme, () => { | ||||||||||||||||||||||||||||||||||||
| if (theme.value.banner) { | ||||||||||||||||||||||||||||||||||||
| return `url(https://picsum.photos/1920/200?${Math.round(Math.random() * 100)})`; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| return 'none'; | ||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||
| </script> | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| <template> | ||||||||||||||||||||||||||||||||||||
|
|
@@ -86,7 +95,14 @@ onMounted(() => { | |||||||||||||||||||||||||||||||||||
| <ColorSwitcherCe /> | ||||||||||||||||||||||||||||||||||||
| <h2 class="text-xl font-semibold font-mono">Vue Components</h2> | ||||||||||||||||||||||||||||||||||||
| <h3 class="text-lg font-semibold font-mono">UserProfileCe</h3> | ||||||||||||||||||||||||||||||||||||
| <header class="bg-header-background-color py-4 flex flex-row justify-between items-center"> | ||||||||||||||||||||||||||||||||||||
| <header | ||||||||||||||||||||||||||||||||||||
| class="bg-header-background-color flex justify-between items-center" | ||||||||||||||||||||||||||||||||||||
| :style="{ | ||||||||||||||||||||||||||||||||||||
| backgroundImage: bannerImage, | ||||||||||||||||||||||||||||||||||||
| backgroundSize: 'cover', | ||||||||||||||||||||||||||||||||||||
| backgroundPosition: 'center' | ||||||||||||||||||||||||||||||||||||
| }" | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+98
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Hardcoding dimensions? What is this, 1999? You're hardcoding banner dimensions in the URL! What happens when someone views this on a 4K display, genius? Make these dimensions responsive! - backgroundImage: bannerImage,
+ backgroundImage: theme.value.banner ?
+ `url(https://picsum.photos/${window.innerWidth}/${Math.round(window.innerWidth * 0.1)}?${Math.round(Math.random() * 100)})` :
+ 'none',
backgroundSize: 'cover',
backgroundPosition: 'center'📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||
| <div class="inline-flex flex-col gap-4 items-start px-4"> | ||||||||||||||||||||||||||||||||||||
| <a href="https://unraid.net" target="_blank"> | ||||||||||||||||||||||||||||||||||||
| <BrandLogo class="w-[100px] sm:w-[150px]" /> | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
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.
🛠️ Refactor suggestion
Side effects in your watch function? Amateur hour!
You're mutating state inside a watch function! This is a recipe for infinite loops and tears!
📝 Committable suggestion