Refine insights UI

This commit is contained in:
Sam Becker 2025-02-13 19:55:48 -06:00
parent 89c985497c
commit ffa2d33514
7 changed files with 158 additions and 149 deletions

View File

@ -213,7 +213,7 @@ export default function AdminAppConfigurationClient({
</WarningNote>; </WarningNote>;
return ( return (
<div className="max-w-xl w-full"> <>
<div className="space-y-3 -mt-3"> <div className="space-y-3 -mt-3">
<ChecklistGroup <ChecklistGroup
title="Storage" title="Storage"
@ -732,6 +732,6 @@ export default function AdminAppConfigurationClient({
</div> </div>
</div>} </div>}
</div> </div>
</div> </>
); );
} }

View File

@ -5,7 +5,6 @@ import ScoreCard from '@/components/ScoreCard';
import ScoreCardRow from '@/components/ScoreCardRow'; import ScoreCardRow from '@/components/ScoreCardRow';
import { dateRangeForPhotos, PhotoDateRange } from '@/photo'; import { dateRangeForPhotos, PhotoDateRange } from '@/photo';
import PhotoFilmSimulationIcon from '@/simulation/PhotoFilmSimulationIcon'; import PhotoFilmSimulationIcon from '@/simulation/PhotoFilmSimulationIcon';
import clsx from 'clsx/lite';
import { FaCamera } from 'react-icons/fa'; import { FaCamera } from 'react-icons/fa';
import { FaTag } from 'react-icons/fa'; import { FaTag } from 'react-icons/fa';
import { FaRegCalendar } from 'react-icons/fa6'; import { FaRegCalendar } from 'react-icons/fa6';
@ -66,29 +65,16 @@ export default function AdminAppInsightsClient({
const { descriptionWithSpaces } = dateRangeForPhotos(undefined, dateRange); const { descriptionWithSpaces } = dateRangeForPhotos(undefined, dateRange);
const renderTitle = (title: string) =>
<div className={clsx(
'uppercase font-medium tracking-wider text-[0.8rem]',
'text-medium',
)}>
{title}
</div>;
return ( return (
<div className={clsx( <div className="space-y-6 md:space-y-8">
'flex flex-col items-center w-full',
)}>
<div className={clsx(
'w-full sm:w-[80%] lg:w-[60%]',
'space-y-4 md:space-y-6',
)}>
{(codeMeta?.isBaseRepo || codeMeta?.isForkedFromBase || debug) && <> {(codeMeta?.isBaseRepo || codeMeta?.isForkedFromBase || debug) && <>
{renderTitle('Build details')} <ScoreCard title="Build details">
<ScoreCard>
<ScoreCardRow <ScoreCardRow
icon={<BiLogoGithub size={17} />} icon={<BiLogoGithub size={17} />}
content={<div className="flex items-center gap-4"> content={<div
<div className="flex items-center gap-1"> className="flex flex-wrap gap-x-4 gap-y-1 overflow-auto"
>
<div className="flex items-center gap-1 *:whitespace-nowrap">
<div>{codeMeta?.owner ?? TEMPLATE_REPO_OWNER}</div> <div>{codeMeta?.owner ?? TEMPLATE_REPO_OWNER}</div>
<div>/</div> <div>/</div>
<div>{codeMeta?.repo ?? TEMPLATE_REPO_NAME}</div> <div>{codeMeta?.repo ?? TEMPLATE_REPO_NAME}</div>
@ -101,18 +87,6 @@ export default function AdminAppInsightsClient({
</div> </div>
</div>} </div>}
/> />
{(codeMeta?.behindBy || debug) &&
<ScoreCardRow
icon={<HiOutlineRefresh
size={17}
className="translate-x-[0.5px] text-amber-600"
/>}
// eslint-disable-next-line max-len
content={`This fork is ${codeMeta?.behindBy ?? 9} commits behind`}
additionalContent={<>
Sync your fork to receive new features and fixes
</>}
/>}
<ScoreCardRow <ScoreCardRow
// icon={<BiLogoGithub size={17} />} // icon={<BiLogoGithub size={17} />}
icon={<BiGitCommit size={18} className="translate-y-[0px]" />} icon={<BiGitCommit size={18} className="translate-y-[0px]" />}
@ -125,10 +99,20 @@ export default function AdminAppInsightsClient({
</div> </div>
</div>} </div>}
/> />
{(codeMeta?.behindBy || debug) &&
<ScoreCardRow
icon={<HiOutlineRefresh
size={17}
className="translate-x-[0.5px] text-blue-500"
/>}
content={`This fork is ${codeMeta?.behindBy ?? 9} commits behind`}
additionalContent={<>
Sync your fork to receive new features and fixes
</>}
/>}
</ScoreCard> </ScoreCard>
</>} </>}
{renderTitle('Template recommendations')} <ScoreCard title="Template recommendations">
<ScoreCard>
<ScoreCardRow <ScoreCardRow
icon={<PiWarningBold icon={<PiWarningBold
size={17} size={17}
@ -157,8 +141,7 @@ export default function AdminAppInsightsClient({
content="Enable AI text generation in the app configuration" content="Enable AI text generation in the app configuration"
/> />
</ScoreCard> </ScoreCard>
{renderTitle('Library Stats')} <ScoreCard title="Library Stats">
<ScoreCard className="uppercase">
<ScoreCardRow <ScoreCardRow
icon={<HiOutlinePhotograph icon={<HiOutlinePhotograph
size={17} size={17}
@ -207,6 +190,5 @@ export default function AdminAppInsightsClient({
/> />
</ScoreCard> </ScoreCard>
</div> </div>
</div>
); );
} }

View File

@ -2,9 +2,9 @@ import clsx from 'clsx/lite';
import { FaInfo } from 'react-icons/fa'; import { FaInfo } from 'react-icons/fa';
export default function AdminAppInsightsIcon({ export default function AdminAppInsightsIcon({
notification = true, indicator = 'blue',
}: { }: {
notification?: boolean, indicator?: 'blue' | 'yellow'
}) { }) {
return ( return (
<span className="inline-flex relative"> <span className="inline-flex relative">
@ -19,11 +19,15 @@ export default function AdminAppInsightsIcon({
aria-label="App Configuration" aria-label="App Configuration"
/> />
</span> </span>
{notification && <span className={clsx( {indicator && <span className={clsx(
'absolute', 'absolute',
'top-[0.5px] right-[-2.5px]', 'top-[0.5px] right-[-2.5px]',
'size-2 rounded-full', 'size-2 rounded-full',
'bg-blue-500', indicator === 'yellow'
? 'bg-amber-500'
: indicator === 'blue'
? 'bg-blue-500'
: undefined,
)} />} )} />}
</span> </span>
); );

View File

@ -22,7 +22,9 @@ export default function AdminInfoPage({
{accessory} {accessory}
</div> </div>
<Container spaceChildren={false}> <Container spaceChildren={false}>
<div className="max-w-xl w-full">
{children} {children}
</div>
</Container> </Container>
</div>} </div>}
/> />

View File

@ -2,18 +2,30 @@ import clsx from 'clsx/lite';
import { ReactNode } from 'react'; import { ReactNode } from 'react';
export default function ScoreCard({ export default function ScoreCard({
title,
children, children,
className, className,
}: { }: {
title?: string,
children: ReactNode, children: ReactNode,
className?: string, className?: string,
}) { }) {
return ( return (
<div className="space-y-3">
{title &&
<div className={clsx( <div className={clsx(
'component-surface shadow-xs divide-y divide-main', 'pl-4',
'uppercase font-medium tracking-wider text-[0.8rem]',
'text-medium',
)}>
{title}
</div>}
<div className={clsx(
'component-surface shadow-xs divide-y divide-medium',
className, className,
)}> )}>
{children} {children}
</div> </div>
</div>
); );
} }

View File

@ -6,10 +6,12 @@ export default function ScoreCardRow({
icon, icon,
content, content,
additionalContent, additionalContent,
className,
}: { }: {
icon: ReactNode icon: ReactNode
content: ReactNode content: ReactNode
additionalContent?: ReactNode additionalContent?: ReactNode
className?: string
}) { }) {
const [isExpanded, setIsExpanded] = useState(false); const [isExpanded, setIsExpanded] = useState(false);
@ -17,6 +19,7 @@ export default function ScoreCardRow({
<div className={clsx( <div className={clsx(
'flex', 'flex',
'py-2 pr-2', 'py-2 pr-2',
className,
)}> )}>
<div className={clsx( <div className={clsx(
'flex justify-center pt-[8px] w-11 sm:w-14', 'flex justify-center pt-[8px] w-11 sm:w-14',

View File

@ -128,6 +128,14 @@
@apply @apply
divide-gray-200 dark:divide-gray-700 divide-gray-200 dark:divide-gray-700
} }
@utility border-medium {
@apply
border border-gray-200 dark:border-gray-800
}
@utility divide-medium {
@apply
divide-gray-200 dark:divide-gray-800
}
/* Background */ /* Background */
@utility bg-main { @utility bg-main {
@apply @apply
@ -139,8 +147,7 @@
} }
@utility bg-content { @utility bg-content {
@apply @apply
bg-white border-gray-200 bg-main border-medium
dark:bg-black dark:border-gray-800
} }
@utility bg-invert { @utility bg-invert {
@apply @apply
@ -305,7 +312,6 @@
@layer components { @layer components {
.component-surface { .component-surface {
@apply @apply
bg-content border-main bg-content rounded-lg
rounded-lg
} }
} }