mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 09:06:56 +08:00
fix: table placeholder
This commit is contained in:
parent
169ae55635
commit
d454214ddc
@ -1,6 +1,8 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import cn from '@/utils/classnames'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
list: any[]
|
list: any[]
|
||||||
@ -9,16 +11,33 @@ type Props = {
|
|||||||
const List: FC<Props> = ({
|
const List: FC<Props> = ({
|
||||||
list,
|
list,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{list.length > 0 ? (
|
{list.length > 0 ? (
|
||||||
<ul className='list-disc pl-5'>
|
<table className={cn('mt-2 w-full min-w-[440px] border-collapse border-0')}>
|
||||||
|
<thead className='system-xs-medium-uppercase text-text-tertiary'>
|
||||||
|
<tr>
|
||||||
|
<td className='whitespace-nowrap rounded-l-lg bg-background-section-burn pl-3 pr-1'>xxx</td>
|
||||||
|
<td className='whitespace-nowrap bg-background-section-burn py-1.5 pl-3'>{t('appLog.table.header.endUser')}</td>
|
||||||
|
<td className='whitespace-nowrap bg-background-section-burn py-1.5 pl-3'>{t('appLog.table.header.userRate')}</td>
|
||||||
|
<td className='whitespace-nowrap bg-background-section-burn py-1.5 pl-3'>{t('appLog.table.header.time')}</td>
|
||||||
|
<td className='whitespace-nowrap rounded-r-lg bg-background-section-burn py-1.5 pl-3'>{t('appLog.table.header.time')}</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="system-sm-regular text-text-secondary"></tbody>
|
||||||
{list.map((item, index) => (
|
{list.map((item, index) => (
|
||||||
<li key={index} className='system-md-regular text-text-primary'>
|
<tr key={index} className='hover:bg-background-section-hover'>
|
||||||
{item}
|
<td className='w-5 whitespace-nowrap rounded-l-lg pl-3 pr-1'>
|
||||||
</li>
|
Python bug fixer
|
||||||
|
</td>
|
||||||
|
<td className='whitespace-nowrap py-1.5 pl-3'>Yes</td>
|
||||||
|
<td className='whitespace-nowrap py-1.5 pl-3'>Evan · evan@dify.ai</td>
|
||||||
|
<td className='whitespace-nowrap py-1.5 pl-3'>2023-03-21 10:25</td>
|
||||||
|
<td className='whitespace-nowrap rounded-r-lg py-1.5 pl-3'>2023-03-21 10:25</td>
|
||||||
|
</tr>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</table>
|
||||||
) : (
|
) : (
|
||||||
<div className='system-md-regular text-text-secondary'>No items found</div>
|
<div className='system-md-regular text-text-secondary'>No items found</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -4,14 +4,16 @@ import Header from './components/header'
|
|||||||
import List from './components/list'
|
import List from './components/list'
|
||||||
import useLegacyList from './use-legacy-list'
|
import useLegacyList from './use-legacy-list'
|
||||||
import Chip from '@/app/components/base/chip'
|
import Chip from '@/app/components/base/chip'
|
||||||
import { RiFilter3Line } from '@remixicon/react'
|
import { RiFilter3Line, RiLoopLeftLine } from '@remixicon/react'
|
||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import Button from '@/app/components/base/button'
|
||||||
|
|
||||||
const i18nPrefix = 'app.checkLegacy'
|
const i18nPrefix = 'app.checkLegacy'
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const {
|
const {
|
||||||
|
list,
|
||||||
sort_by,
|
sort_by,
|
||||||
setOrderBy,
|
setOrderBy,
|
||||||
published,
|
published,
|
||||||
@ -38,34 +40,40 @@ const Page = () => {
|
|||||||
<div className='h-full rounded-t-2xl border-t border-effects-highlight bg-background-default-subtle px-6 pt-4'>
|
<div className='h-full rounded-t-2xl border-t border-effects-highlight bg-background-default-subtle px-6 pt-4'>
|
||||||
<Header appNum={5} publishedNum={3}/>
|
<Header appNum={5} publishedNum={3}/>
|
||||||
{/* Filter */}
|
{/* Filter */}
|
||||||
<div className='mb-2 mt-4 flex flex-row flex-wrap items-center gap-2'>
|
<div className='mb-2 mt-4 flex items-center justify-between'>
|
||||||
<Chip
|
<div className='flex items-center gap-2'>
|
||||||
className='min-w-[150px]'
|
<Chip
|
||||||
panelClassName='w-[270px]'
|
className='min-w-[150px]'
|
||||||
leftIcon={<RiFilter3Line className='h-4 w-4 text-text-secondary' />}
|
panelClassName='w-[270px]'
|
||||||
value={published}
|
leftIcon={<RiFilter3Line className='h-4 w-4 text-text-secondary' />}
|
||||||
renderTriggerContent={renderTriggerContent}
|
value={published}
|
||||||
onSelect={handleSelectPublished}
|
renderTriggerContent={renderTriggerContent}
|
||||||
onClear={clearPublished}
|
onSelect={handleSelectPublished}
|
||||||
items={[
|
onClear={clearPublished}
|
||||||
{ value: 1, name: t(`${i18nPrefix}.yes`) },
|
items={[
|
||||||
{ value: 0, name: t(`${i18nPrefix}.no`) },
|
{ value: 1, name: t(`${i18nPrefix}.yes`) },
|
||||||
]}
|
{ value: 0, name: t(`${i18nPrefix}.no`) },
|
||||||
/>
|
]}
|
||||||
<div className='h-3.5 w-px bg-divider-regular'></div>
|
/>
|
||||||
<Sort
|
<div className='h-3.5 w-px bg-divider-regular'></div>
|
||||||
// '-' means descending order
|
<Sort
|
||||||
order={sort_by?.startsWith('-') ? '-' : ''}
|
// '-' means descending order
|
||||||
value={sort_by?.replace('-', '') || 'created_at'}
|
order={sort_by?.startsWith('-') ? '-' : ''}
|
||||||
items={[
|
value={sort_by?.replace('-', '') || 'created_at'}
|
||||||
{ value: 'created_at', name: t(`${i18nPrefix}.createAt`) },
|
items={[
|
||||||
{ value: 'last_request', name: t(`${i18nPrefix}.lastRequest`) },
|
{ value: 'created_at', name: t(`${i18nPrefix}.createAt`) },
|
||||||
]}
|
{ value: 'last_request', name: t(`${i18nPrefix}.lastRequest`) },
|
||||||
onSelect={setOrderBy}
|
]}
|
||||||
/>
|
onSelect={setOrderBy}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<Button >
|
||||||
|
<RiLoopLeftLine className='mr-1 h-4 w-4' />
|
||||||
|
{t('common.operation.reset')}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<List list={[]} />
|
<List list={list} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import produce from 'immer'
|
|||||||
import { useCallback, useState } from 'react'
|
import { useCallback, useState } from 'react'
|
||||||
|
|
||||||
const useLegacyList = () => {
|
const useLegacyList = () => {
|
||||||
|
const list: any[] = [{}, {}, {}] // Placeholder for the list, replace with actual data fetching logic
|
||||||
const [queryParams, setQueryParams] = useState<Record<string, any>>({})
|
const [queryParams, setQueryParams] = useState<Record<string, any>>({})
|
||||||
const {
|
const {
|
||||||
sort_by,
|
sort_by,
|
||||||
@ -29,6 +30,7 @@ const useLegacyList = () => {
|
|||||||
}, [queryParams])
|
}, [queryParams])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
list,
|
||||||
sort_by,
|
sort_by,
|
||||||
setOrderBy,
|
setOrderBy,
|
||||||
published,
|
published,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user