Refine insights UI
This commit is contained in:
parent
89c985497c
commit
ffa2d33514
@ -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>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,147 +65,130 @@ 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',
|
{(codeMeta?.isBaseRepo || codeMeta?.isForkedFromBase || debug) && <>
|
||||||
)}>
|
<ScoreCard title="Build details">
|
||||||
<div className={clsx(
|
<ScoreCardRow
|
||||||
'w-full sm:w-[80%] lg:w-[60%]',
|
icon={<BiLogoGithub size={17} />}
|
||||||
'space-y-4 md:space-y-6',
|
content={<div
|
||||||
)}>
|
className="flex flex-wrap gap-x-4 gap-y-1 overflow-auto"
|
||||||
{(codeMeta?.isBaseRepo || codeMeta?.isForkedFromBase || debug) && <>
|
>
|
||||||
{renderTitle('Build details')}
|
<div className="flex items-center gap-1 *:whitespace-nowrap">
|
||||||
<ScoreCard>
|
<div>{codeMeta?.owner ?? TEMPLATE_REPO_OWNER}</div>
|
||||||
<ScoreCardRow
|
<div>/</div>
|
||||||
icon={<BiLogoGithub size={17} />}
|
<div>{codeMeta?.repo ?? TEMPLATE_REPO_NAME}</div>
|
||||||
content={<div className="flex items-center gap-4">
|
</div>
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1 min-w-0">
|
||||||
<div>{codeMeta?.owner ?? TEMPLATE_REPO_OWNER}</div>
|
<div><BiGitBranch size={17} /></div>
|
||||||
<div>/</div>
|
|
||||||
<div>{codeMeta?.repo ?? TEMPLATE_REPO_NAME}</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-1 min-w-0">
|
|
||||||
<div><BiGitBranch size={17} /></div>
|
|
||||||
<div className="truncate">
|
|
||||||
{codeMeta?.branch ?? TEMPLATE_REPO_BRANCH}
|
|
||||||
</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
|
|
||||||
// icon={<BiLogoGithub size={17} />}
|
|
||||||
icon={<BiGitCommit size={18} className="translate-y-[0px]" />}
|
|
||||||
content={<div className="flex items-center gap-2">
|
|
||||||
<div className="text-medium">
|
|
||||||
{VERCEL_GIT_COMMIT_SHA_SHORT ?? DEBUG_COMMIT_SHA}
|
|
||||||
</div>
|
|
||||||
<div className="truncate">
|
<div className="truncate">
|
||||||
{codeMeta?.commit ?? DEBUG_COMMIT_MESSAGE}
|
{codeMeta?.branch ?? TEMPLATE_REPO_BRANCH}
|
||||||
</div>
|
</div>
|
||||||
</div>}
|
</div>
|
||||||
/>
|
</div>}
|
||||||
</ScoreCard>
|
|
||||||
</>}
|
|
||||||
{renderTitle('Template recommendations')}
|
|
||||||
<ScoreCard>
|
|
||||||
<ScoreCardRow
|
|
||||||
icon={<PiWarningBold
|
|
||||||
size={17}
|
|
||||||
className="translate-x-[0.5px] text-amber-600"
|
|
||||||
/>}
|
|
||||||
content="AI enabled without rate limiting"
|
|
||||||
// eslint-disable-next-line max-len
|
|
||||||
additionalContent="Create Vercel KV store and link it to this project in order to enable rate limiting."
|
|
||||||
/>
|
/>
|
||||||
<ScoreCardRow
|
<ScoreCardRow
|
||||||
icon={<MdLightbulbOutline size={19} />}
|
// icon={<BiLogoGithub size={17} />}
|
||||||
// eslint-disable-next-line max-len
|
icon={<BiGitCommit size={18} className="translate-y-[0px]" />}
|
||||||
content="You seem to have several vertical photos—consider enabling matting to make portrait and landscape photos appear more consistent"
|
content={<div className="flex items-center gap-2">
|
||||||
additionalContent={<>
|
<div className="text-medium">
|
||||||
Enabled photo matting by setting
|
{VERCEL_GIT_COMMIT_SHA_SHORT ?? DEBUG_COMMIT_SHA}
|
||||||
<code className="text-main">`NEXT_PUBLIC_MATTE_PHOTOS = 1`</code>
|
</div>
|
||||||
</>}
|
<div className="truncate">
|
||||||
|
{codeMeta?.commit ?? DEBUG_COMMIT_MESSAGE}
|
||||||
|
</div>
|
||||||
|
</div>}
|
||||||
/>
|
/>
|
||||||
<ScoreCardRow
|
{(codeMeta?.behindBy || debug) &&
|
||||||
icon={<IconGrSync />}
|
|
||||||
// eslint-disable-next-line max-len
|
|
||||||
content="Consider forking this repository to receive new features and fixes"
|
|
||||||
/>
|
|
||||||
<ScoreCardRow
|
|
||||||
icon={<HiSparkles />}
|
|
||||||
content="Enable AI text generation in the app configuration"
|
|
||||||
/>
|
|
||||||
</ScoreCard>
|
|
||||||
{renderTitle('Library Stats')}
|
|
||||||
<ScoreCard className="uppercase">
|
|
||||||
<ScoreCardRow
|
|
||||||
icon={<HiOutlinePhotograph
|
|
||||||
size={17}
|
|
||||||
className="translate-y-[0.5px]"
|
|
||||||
/>}
|
|
||||||
content={<>
|
|
||||||
{photosCount} photos
|
|
||||||
{photosCountHidden > 0 &&
|
|
||||||
` (${photosCountHidden} hidden)`}
|
|
||||||
</>}
|
|
||||||
/>
|
|
||||||
<ScoreCardRow
|
|
||||||
icon={<FaTag
|
|
||||||
size={12}
|
|
||||||
className="translate-y-[3px]"
|
|
||||||
/>}
|
|
||||||
content={`${tagsCount} tags`}
|
|
||||||
/>
|
|
||||||
<ScoreCardRow
|
|
||||||
icon={<FaCamera
|
|
||||||
size={13}
|
|
||||||
className="translate-y-[2px]"
|
|
||||||
/>}
|
|
||||||
content={`${camerasCount} cameras`}
|
|
||||||
/>
|
|
||||||
{filmSimulationsCount &&
|
|
||||||
<ScoreCardRow
|
<ScoreCardRow
|
||||||
icon={<span className="inline-flex w-3">
|
icon={<HiOutlineRefresh
|
||||||
<PhotoFilmSimulationIcon
|
size={17}
|
||||||
className="shrink-0 translate-x-[-1px] translate-y-[-0.5px]"
|
className="translate-x-[0.5px] text-blue-500"
|
||||||
height={18}
|
/>}
|
||||||
/>
|
content={`This fork is ${codeMeta?.behindBy ?? 9} commits behind`}
|
||||||
</span>}
|
additionalContent={<>
|
||||||
content={`${filmSimulationsCount} film simulations`}
|
Sync your fork to receive new features and fixes
|
||||||
|
</>}
|
||||||
/>}
|
/>}
|
||||||
<ScoreCardRow
|
|
||||||
icon={<TbCone className="rotate-[270deg] translate-x-[-2px]" />}
|
|
||||||
content={`${lensesCount} lenses`}
|
|
||||||
/>
|
|
||||||
<ScoreCardRow
|
|
||||||
icon={<FaRegCalendar
|
|
||||||
size={13}
|
|
||||||
className="translate-y-[1.5px] translate-x-[-2px]"
|
|
||||||
/>}
|
|
||||||
content={descriptionWithSpaces}
|
|
||||||
/>
|
|
||||||
</ScoreCard>
|
</ScoreCard>
|
||||||
</div>
|
</>}
|
||||||
|
<ScoreCard title="Template recommendations">
|
||||||
|
<ScoreCardRow
|
||||||
|
icon={<PiWarningBold
|
||||||
|
size={17}
|
||||||
|
className="translate-x-[0.5px] text-amber-600"
|
||||||
|
/>}
|
||||||
|
content="AI enabled without rate limiting"
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
additionalContent="Create Vercel KV store and link it to this project in order to enable rate limiting."
|
||||||
|
/>
|
||||||
|
<ScoreCardRow
|
||||||
|
icon={<MdLightbulbOutline size={19} />}
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
content="You seem to have several vertical photos—consider enabling matting to make portrait and landscape photos appear more consistent"
|
||||||
|
additionalContent={<>
|
||||||
|
Enabled photo matting by setting
|
||||||
|
<code className="text-main">`NEXT_PUBLIC_MATTE_PHOTOS = 1`</code>
|
||||||
|
</>}
|
||||||
|
/>
|
||||||
|
<ScoreCardRow
|
||||||
|
icon={<IconGrSync />}
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
content="Consider forking this repository to receive new features and fixes"
|
||||||
|
/>
|
||||||
|
<ScoreCardRow
|
||||||
|
icon={<HiSparkles />}
|
||||||
|
content="Enable AI text generation in the app configuration"
|
||||||
|
/>
|
||||||
|
</ScoreCard>
|
||||||
|
<ScoreCard title="Library Stats">
|
||||||
|
<ScoreCardRow
|
||||||
|
icon={<HiOutlinePhotograph
|
||||||
|
size={17}
|
||||||
|
className="translate-y-[0.5px]"
|
||||||
|
/>}
|
||||||
|
content={<>
|
||||||
|
{photosCount} photos
|
||||||
|
{photosCountHidden > 0 &&
|
||||||
|
` (${photosCountHidden} hidden)`}
|
||||||
|
</>}
|
||||||
|
/>
|
||||||
|
<ScoreCardRow
|
||||||
|
icon={<FaTag
|
||||||
|
size={12}
|
||||||
|
className="translate-y-[3px]"
|
||||||
|
/>}
|
||||||
|
content={`${tagsCount} tags`}
|
||||||
|
/>
|
||||||
|
<ScoreCardRow
|
||||||
|
icon={<FaCamera
|
||||||
|
size={13}
|
||||||
|
className="translate-y-[2px]"
|
||||||
|
/>}
|
||||||
|
content={`${camerasCount} cameras`}
|
||||||
|
/>
|
||||||
|
{filmSimulationsCount &&
|
||||||
|
<ScoreCardRow
|
||||||
|
icon={<span className="inline-flex w-3">
|
||||||
|
<PhotoFilmSimulationIcon
|
||||||
|
className="shrink-0 translate-x-[-1px] translate-y-[-0.5px]"
|
||||||
|
height={18}
|
||||||
|
/>
|
||||||
|
</span>}
|
||||||
|
content={`${filmSimulationsCount} film simulations`}
|
||||||
|
/>}
|
||||||
|
<ScoreCardRow
|
||||||
|
icon={<TbCone className="rotate-[270deg] translate-x-[-2px]" />}
|
||||||
|
content={`${lensesCount} lenses`}
|
||||||
|
/>
|
||||||
|
<ScoreCardRow
|
||||||
|
icon={<FaRegCalendar
|
||||||
|
size={13}
|
||||||
|
className="translate-y-[1.5px] translate-x-[-2px]"
|
||||||
|
/>}
|
||||||
|
content={descriptionWithSpaces}
|
||||||
|
/>
|
||||||
|
</ScoreCard>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -22,7 +22,9 @@ export default function AdminInfoPage({
|
|||||||
{accessory}
|
{accessory}
|
||||||
</div>
|
</div>
|
||||||
<Container spaceChildren={false}>
|
<Container spaceChildren={false}>
|
||||||
{children}
|
<div className="max-w-xl w-full">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
</Container>
|
</Container>
|
||||||
</div>}
|
</div>}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -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={clsx(
|
<div className="space-y-3">
|
||||||
'component-surface shadow-xs divide-y divide-main',
|
{title &&
|
||||||
className,
|
<div className={clsx(
|
||||||
)}>
|
'pl-4',
|
||||||
{children}
|
'uppercase font-medium tracking-wider text-[0.8rem]',
|
||||||
|
'text-medium',
|
||||||
|
)}>
|
||||||
|
{title}
|
||||||
|
</div>}
|
||||||
|
<div className={clsx(
|
||||||
|
'component-surface shadow-xs divide-y divide-medium',
|
||||||
|
className,
|
||||||
|
)}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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',
|
||||||
|
|||||||
14
tailwind.css
14
tailwind.css
@ -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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user