ui: fix max meta length, add horizontal layout for player

This commit is contained in:
nick-delirium 2025-05-06 16:21:02 +02:00 committed by Delirium
parent 93ae18133e
commit f4d5b3c06e
3 changed files with 11 additions and 9 deletions

View file

@ -114,13 +114,11 @@ function PlayerBlockHeader(props: any) {
)}
{_metaList.length > 0 && (
<div className="h-full flex items-center px-2 gap-1">
<SessionMetaList
className=""
metaList={_metaList}
maxLength={2}
/>
</div>
<SessionMetaList
horizontal
metaList={_metaList}
maxLength={2}
/>
)}
</div>
</div>

View file

@ -19,11 +19,13 @@ export default function MetaItem(props: Props) {
<TextEllipsis
text={label}
className="p-0"
maxWidth={'300px'}
popupProps={{ size: 'small', disabled: true }}
/>
<span className="bg-neutral-200 inline-block w-[1px] min-h-[17px]"></span>
<TextEllipsis
text={value}
maxWidth={'350px'}
className="p-0 text-neutral-500"
popupProps={{ size: 'small', disabled: true }}
/>

View file

@ -7,13 +7,15 @@ interface Props {
className?: string;
metaList: any[];
maxLength?: number;
onMetaClick?: (meta: { name: string, value: string }) => void;
horizontal?: boolean;
}
export default function SessionMetaList(props: Props) {
const { className = '', metaList, maxLength = 14 } = props;
const { className = '', metaList, maxLength = 14, horizontal = false } = props;
return (
<div className={cn('flex items-center flex-wrap gap-1', className)}>
<div className={cn('flex items-center gap-1', horizontal ? '' : 'flex-wrap', className)}>
{metaList.slice(0, maxLength).map(({ label, value }, index) => (
<React.Fragment key={index}>
<MetaItem label={label} value={`${value}`} />