Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat(studio): finesse logs date picker range colours (#48019)

Danny White50e9fedb2039
diff --git a/apps/studio/components/interfaces/Settings/Logs/Logs.DatePickers.tsx b/apps/studio/components/interfaces/Settings/Logs/Logs.DatePickers.tsx
index 7da4fab326e..1c1c6975f52 100644
--- a/apps/studio/components/interfaces/Settings/Logs/Logs.DatePickers.tsx
+++ b/apps/studio/components/interfaces/Settings/Logs/Logs.DatePickers.tsx
@@ -403,7 +403,7 @@ export const LogsDatePicker = ({
</RadioGroup>
</div>
- <div>
+ <div className="w-fit max-w-full">
<div className="flex p-2 gap-2 items-center">
<div className="flex grow *:grow gap-2 font-mono">
<TimeSplitInput
@@ -447,7 +447,7 @@ export const LogsDatePicker = ({
></ButtonTooltip>
</div>
</div>
- <div className="p-2 border-t">
+ <div className="border-t">
<Calendar
mode="range"
month={currentMonth}
@@ -459,9 +459,9 @@ export const LogsDatePicker = ({
/>
</div>
{isLargeRange && !hideWarnings && (
- <div className="text-xs px-3 py-1.5 border-y bg-warning-300 border-warning-500 text-warning">
- Large ranges may result in memory errors for <br /> big projects.
- </div>
+ <p className="w-0 min-w-full px-3 pt-1 pb-4 text-xs text-warning">
+ Large ranges may result in memory errors for big projects.
+ </p>
)}
<div className="flex items-center justify-end gap-2 p-2 border-t">
{startDate && endDate ? (
@@ -470,7 +470,7 @@ export const LogsDatePicker = ({
size="tiny"
onClick={handleCopy}
className={cn({
- 'text-brand-600': copied || pasted,
+ 'text-brand-link': copied || pasted,
})}
>
{copied ? 'Copied!' : pasted ? 'Pasted!' : 'Copy range'}
diff --git a/apps/studio/components/ui/DatePicker/TimeSplitInput.tsx b/apps/studio/components/ui/DatePicker/TimeSplitInput.tsx
index 6851e41d356..e2337a14ddc 100644
--- a/apps/studio/components/ui/DatePicker/TimeSplitInput.tsx
+++ b/apps/studio/components/ui/DatePicker/TimeSplitInput.tsx
@@ -1,5 +1,4 @@
import { format } from 'date-fns'
-import { Clock } from 'lucide-react'
import { useEffect, useState } from 'react'
import { cn } from 'ui'
@@ -235,10 +234,6 @@ export const TimeSplitInput = ({
hover:border-stronger transition-colors
`}
>
- <div className="mr-1 text-foreground-lighter">
- <Clock size={14} strokeWidth={1.5} />
- </div>
-
<input
type="text"
onBlur={() => handleOnBlur()}
diff --git a/packages/ui/src/components/shadcn/ui/calendar.tsx b/packages/ui/src/components/shadcn/ui/calendar.tsx
index ced618435f5..05fa59a7bdd 100644
--- a/packages/ui/src/components/shadcn/ui/calendar.tsx
+++ b/packages/ui/src/components/shadcn/ui/calendar.tsx
@@ -69,23 +69,42 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }: C
weekday: cn('text-foreground-muted rounded-md w-9 font-normal text-[0.8rem]', weekday),
week: cn('flex w-full mt-2', week),
day: cn(
- 'text-center text-sm p-0 relative [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md',
- 'last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20',
+ 'text-center text-sm p-0 relative',
+ 'first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md',
+ 'focus-within:relative focus-within:z-20',
'w-9 box-border',
day
),
day_button: cn(
buttonVariants({ variant: 'ghost' }),
- 'h-9 w-9 p-0 font-normal aria-selected:opacity-100',
+ 'h-9 w-9 p-0 font-normal rounded-md aria-selected:opacity-100',
+ // Keep selected days from picking up ghost hover bg/text
+ 'aria-selected:hover:bg-transparent aria-selected:hover:text-inherit',
day_button
),
- selected: cn('bg-brand-500 text-foreground text-foreground', selected),
+ selected: cn(
+ !fullDateRangeSelected && 'bg-brand-400! dark:bg-brand-500! text-foreground rounded-md',
+ selected
+ ),
+ // Plain accent — range/selected fills use ! so they still win when today is in the selection
today: cn('bg-accent text-accent-foreground', today),
- outside: cn('text-foreground-muted opacity-50', outside),
+ outside: cn(
+ 'text-foreground-muted opacity-50 has-[[aria-selected]]:opacity-100 has-[[aria-selected]]:text-foreground',
+ outside
+ ),
disabled: cn('text-foreground-muted opacity-50', disabled),
- range_start: cn(fullDateRangeSelected && 'bg-brand-500 rounded-r-none', range_start),
- range_middle: cn('aria-selected:bg-brand-400 rounded-none', range_middle),
- range_end: cn(fullDateRangeSelected && 'bg-brand-500 rounded-l-none', range_end),
+ range_start: cn(
+ fullDateRangeSelected && 'bg-brand-400! dark:bg-brand-500! text-foreground rounded-l-md',
+ range_start
+ ),
+ range_middle: cn(
+ 'bg-brand-200! dark:bg-brand-400! text-foreground rounded-none',
+ range_middle
+ ),
+ range_end: cn(
+ fullDateRangeSelected && 'bg-brand-400! dark:bg-brand-500! text-foreground rounded-r-md',
+ range_end
+ ),
hidden: cn('invisible', hidden),
...restClassNames,
}}