Skip to content

Commit

Permalink
Update item previews
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Dec 20, 2024
1 parent eb1b0fa commit c29f0c5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
21 changes: 11 additions & 10 deletions web/src/components/item/ItemPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { useMedia } from '@/api/media';

import { LocationPreview } from '../location/LocationPreview';
import { Tag } from '../Tag';
import { UserProfile } from '../UserProfile';

const UNKNOWN_ITEM = 'Unknown Item';

Expand Down Expand Up @@ -202,15 +201,17 @@ const ItemPreviewLarge: FC<{
{formattedItemId && (
<div className="bg-background absolute left-0 top-0 z-10 rounded-br-md rounded-tl-md border-b border-r px-1 py-0.5 text-sm">#{formattedItemId}</div>
)}
<AvatarHolder
item_id={item?.item_id}
image={mediaUrl}
alt={item?.name || UNKNOWN_ITEM}
size="large"
key={`media-${item?.item_id}`}
randomHue={randomHue}
/>
<div className="flex grow flex-col justify-center -space-y-1.5 overflow-hidden py-4">
<div className="mx-auto md:mx-0">
<AvatarHolder
item_id={item?.item_id}
image={mediaUrl}
alt={item?.name || UNKNOWN_ITEM}
size="large"
key={`media-${item?.item_id}`}
randomHue={randomHue}
/>
</div>
<div className="flex max-w-full grow flex-col justify-center -space-y-1.5 overflow-hidden py-4">
<div className='grow'>
<div className="overflow-hidden text-ellipsis whitespace-nowrap text-base">
{item?.name || UNKNOWN_ITEM}
Expand Down
6 changes: 5 additions & 1 deletion web/src/routes/item/$itemId/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { UserProfile } from '@/components/UserProfile';
import { YeetButton } from '@/components/YeetButton';
import { SCPage } from '@/layouts/SimpleCenterPage';
import { queryClient } from '@/util/query';
import { toast } from 'sonner';

export const Route = createFileRoute('/item/$itemId/')({
// if item_id is not formatId(item_id, instanceSettings), redirect to the formatted item_id
Expand Down Expand Up @@ -80,7 +81,10 @@ export const Route = createFileRoute('/item/$itemId/')({
subtext={
<>
<span>{`#${itemId}`}</span>
<Button variant='ghost' size='small-icon' onClick={() => navigator.clipboard.writeText(itemId)}><FiCopy size={10} className='size-2 text-xs' /></Button>
<Button variant='ghost' size='small-icon' onClick={() => {
navigator.clipboard.writeText(itemId);
toast.success('Copied to clipboard');
}}><FiCopy size={10} className='size-2 text-xs' /></Button>
</>
}
suffix={
Expand Down

0 comments on commit c29f0c5

Please sign in to comment.