Fix admin tag editor icon alignment
This commit is contained in:
parent
7868f70c95
commit
dba4e534fb
@ -6,6 +6,8 @@ import { PATH_ADMIN, PATH_ADMIN_TAGS, pathForTag } from '@/site/paths';
|
||||
import PhotoTag from '@/tag/PhotoTag';
|
||||
import { photoLabelForCount } from '@/photo';
|
||||
import PhotoLightbox from '@/photo/PhotoLightbox';
|
||||
import FavsTag from '@/tag/FavsTag';
|
||||
import { isTagFavs } from '@/tag';
|
||||
|
||||
const MAX_PHOTO_TO_SHOW = 6;
|
||||
|
||||
@ -28,8 +30,14 @@ export default async function PhotoPageEdit({ params: { tag } }: Props) {
|
||||
<AdminChildPage
|
||||
backPath={PATH_ADMIN_TAGS}
|
||||
backLabel="Tags"
|
||||
breadcrumb={<div className="flex item gap-2">
|
||||
<PhotoTag {...{ tag }} />
|
||||
breadcrumb={<div className="flex items-center gap-2">
|
||||
{isTagFavs(tag)
|
||||
? <div className="[&>*>*>*>svg]:translate-y-[0.5px]">
|
||||
<FavsTag />
|
||||
</div>
|
||||
: <div className="[&>*>*>*>svg]:translate-y-[1.5px]">
|
||||
<PhotoTag {...{ tag }} />
|
||||
</div>}
|
||||
<div className="text-dim uppercase">
|
||||
<span>{count}</span>
|
||||
<span className="hidden xs:inline-block">
|
||||
|
||||
@ -7,10 +7,11 @@ import DeleteButton from '@/admin/DeleteButton';
|
||||
import { photoQuantityText } from '@/photo';
|
||||
import { getUniqueTagsHiddenCached } from '@/cache';
|
||||
import PhotoTag from '@/tag/PhotoTag';
|
||||
import { formatTag } from '@/tag';
|
||||
import { formatTag, isTagFavs, sortTagsObject } from '@/tag';
|
||||
import EditButton from '@/admin/EditButton';
|
||||
import { pathForAdminTagEdit } from '@/site/paths';
|
||||
import { clsx } from 'clsx/lite';
|
||||
import FavsTag from '@/tag/FavsTag';
|
||||
|
||||
export default async function AdminTagsPage() {
|
||||
const tags = await getUniqueTagsHiddenCached();
|
||||
@ -21,10 +22,12 @@ export default async function AdminTagsPage() {
|
||||
<div className="space-y-6">
|
||||
<div className="space-y-4">
|
||||
<AdminGrid>
|
||||
{tags.map(({ tag, count }) =>
|
||||
{sortTagsObject(tags).map(({ tag, count }) =>
|
||||
<Fragment key={tag}>
|
||||
<div className="pr-2 -translate-y-0.5">
|
||||
<PhotoTag {...{ tag }} />
|
||||
{isTagFavs(tag)
|
||||
? <FavsTag />
|
||||
: <PhotoTag {...{ tag }} />}
|
||||
</div>
|
||||
<div className="text-dim uppercase">
|
||||
{photoQuantityText(count, false)}
|
||||
|
||||
@ -33,9 +33,16 @@ export const sortTags = (
|
||||
tags: string[],
|
||||
tagToHide?: string,
|
||||
) => tags
|
||||
.filter(t => t !== tagToHide)
|
||||
.filter(tag => tag !== tagToHide)
|
||||
.sort((a, b) => isTagFavs(a) ? -1 : a.localeCompare(b));
|
||||
|
||||
export const sortTagsObject = (
|
||||
tags: Tags,
|
||||
tagToHide?: string,
|
||||
) => tags
|
||||
.filter(({ tag }) => tag!== tagToHide)
|
||||
.sort(({ tag: a }, { tag: b }) => isTagFavs(a) ? -1 : a.localeCompare(b));
|
||||
|
||||
export const descriptionForTaggedPhotos = (
|
||||
photos: Photo[],
|
||||
dateBased?: boolean,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user