Skip to content

Commit 3453932

Browse files
committed
fix(settings): improve sidebar skeleton fidelity and fix credit purchase org cache invalidation
- Bump skeleton icon and text from 16/14px to 24px to better match real nav item visual weight - Add orgId support to usePurchaseCredits so org billing/subscription caches are invalidated on credit purchase, matching the pattern used by useUpgradeSubscription - Polish ColorInput in whitelabeling settings with auto-prefix and select-on-focus UX
1 parent 96e3914 commit 3453932

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-sidebar/settings-sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ export function SettingsSidebar({
284284
<div className='flex flex-col gap-0.5 px-2'>
285285
{Array.from({ length: count }, (_, j) => (
286286
<div key={j} className='mx-0.5 flex h-[30px] items-center gap-2 px-2'>
287-
<Skeleton className='h-[16px] w-[16px] flex-shrink-0 rounded-sm' />
288-
<Skeleton className='sidebar-collapse-hide h-[14px] w-full rounded-sm' />
287+
<Skeleton className='h-[24px] w-[24px] flex-shrink-0 rounded-sm' />
288+
<Skeleton className='sidebar-collapse-hide h-[24px] w-full rounded-sm' />
289289
</div>
290290
))}
291291
</div>

apps/sim/ee/whitelabeling/components/whitelabeling-settings.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,22 @@ interface ColorInputProps {
7979
function ColorInput({ label, value, onChange, placeholder = '#000000' }: ColorInputProps) {
8080
const isValidHex = !value || HEX_COLOR_REGEX.test(value)
8181

82+
const handleChange = useCallback(
83+
(e: React.ChangeEvent<HTMLInputElement>) => {
84+
let v = e.target.value.trim()
85+
if (v && !v.startsWith('#')) {
86+
v = `#${v}`
87+
}
88+
v = v.slice(0, 1) + v.slice(1).replace(/[^0-9a-fA-F]/g, '')
89+
onChange(v.slice(0, 7))
90+
},
91+
[onChange]
92+
)
93+
94+
const handleFocus = useCallback((e: React.FocusEvent<HTMLInputElement>) => {
95+
e.target.select()
96+
}, [])
97+
8298
return (
8399
<div className='flex flex-col gap-1.5'>
84100
<Label className='text-[13px] text-[var(--text-primary)]'>{label}</Label>
@@ -92,7 +108,8 @@ function ColorInput({ label, value, onChange, placeholder = '#000000' }: ColorIn
92108
</div>
93109
<Input
94110
value={value}
95-
onChange={(e) => onChange(e.target.value)}
111+
onChange={handleChange}
112+
onFocus={handleFocus}
96113
placeholder={placeholder}
97114
className={cn(
98115
'h-[36px] font-mono text-[13px]',

apps/sim/hooks/queries/subscription.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ export function useUpgradeSubscription() {
303303
interface PurchaseCreditsParams {
304304
amount: number
305305
requestId: string
306+
orgId?: string
306307
}
307308

308309
export function usePurchaseCredits() {
@@ -324,9 +325,13 @@ export function usePurchaseCredits() {
324325

325326
return data
326327
},
327-
onSuccess: () => {
328+
onSuccess: (_data, variables) => {
328329
queryClient.invalidateQueries({ queryKey: subscriptionKeys.users() })
329330
queryClient.invalidateQueries({ queryKey: subscriptionKeys.usage() })
331+
if (variables.orgId) {
332+
queryClient.invalidateQueries({ queryKey: organizationKeys.billing(variables.orgId) })
333+
queryClient.invalidateQueries({ queryKey: organizationKeys.subscription(variables.orgId) })
334+
}
330335
},
331336
})
332337
}

0 commit comments

Comments
 (0)