Refactor: Properties in der react app geändert.

This commit is contained in:
OlgunR 2025-07-28 10:29:05 +02:00
parent 4b3c5907ae
commit c9cb3f6aa8
3 changed files with 29 additions and 30 deletions

View File

@ -15,23 +15,23 @@ import { Iconify } from 'src/components/iconify';
// ----------------------------------------------------------------------
export type UserProps = {
id: string;
name: string;
role: string;
export type EnvelopeProps = {
title: string;
status: string;
company: string;
avatarUrl: string;
isVerified: boolean;
type: string;
isPartiallySigned: boolean;
isTotallySigned: boolean;
addedWhen: Date;
changedWhen: Date;
};
type UserTableRowProps = {
row: UserProps;
type EnvelopeTableRowProps = {
row: EnvelopeProps;
selected: boolean;
onSelectRow: () => void;
};
export function UserTableRow({ row, selected, onSelectRow }: UserTableRowProps) {
export function EnvelopeTableRow({ row, selected, onSelectRow }: EnvelopeTableRowProps) {
const [openPopover, setOpenPopover] = useState<HTMLButtonElement | null>(null);
const handleOpenPopover = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {
@ -57,27 +57,26 @@ export function UserTableRow({ row, selected, onSelectRow }: UserTableRowProps)
alignItems: 'center',
}}
>
<Avatar alt={row.name} src={row.avatarUrl} />
{row.name}
{row.title}
</Box>
</TableCell>
<TableCell>{row.company}</TableCell>
<TableCell>{row.role}</TableCell>
<TableCell align="center">
{row.isVerified ? (
<Iconify width={22} icon="solar:check-circle-bold" sx={{ color: 'success.main' }} />
) : (
'-'
)}
</TableCell>
{/* TODO: arrange the status, type */}
<TableCell>
<Label color={(row.status === 'banned' && 'error') || 'success'}>{row.status}</Label>
</TableCell>
<TableCell>{row.type}</TableCell>
<TableCell align="center">
{row.isTotallySigned
? <Iconify width={22} icon="solar:check-circle-bold" sx={{ color: 'success.main' }} />
: row.isPartiallySigned
? <Iconify width={22} icon="solar:check-circle-bold" sx={{ color: 'warning.main' }} />
: <Iconify width={22} icon="eva:more-vertical-fill" sx={{ color: 'error.main' }} />
}
</TableCell>
<TableCell align="right">
<IconButton onClick={handleOpenPopover}>
<Iconify icon="eva:more-vertical-fill" />

View File

@ -1,4 +1,4 @@
import type { UserProps } from './user-table-row';
import type { EnvelopeProps } from './user-table-row';
// ----------------------------------------------------------------------
@ -53,7 +53,7 @@ export function getComparator<Key extends keyof any>(
// ----------------------------------------------------------------------
type ApplyFilterProps = {
inputData: UserProps[];
inputData: EnvelopeProps[];
filterName: string;
comparator: (a: any, b: any) => number;
};

View File

@ -16,13 +16,13 @@ import { Iconify } from 'src/components/iconify';
import { Scrollbar } from 'src/components/scrollbar';
import { TableNoData } from '../table-no-data';
import { UserTableRow } from '../user-table-row';
import { EnvelopeTableRow } from '../user-table-row';
import { UserTableHead } from '../user-table-head';
import { TableEmptyRows } from '../table-empty-rows';
import { UserTableToolbar } from '../user-table-toolbar';
import { emptyRows, applyFilter, getComparator } from '../utils';
import type { UserProps } from '../user-table-row';
import type { EnvelopeProps } from '../user-table-row';
// ----------------------------------------------------------------------
@ -31,7 +31,7 @@ export function UserView() {
const [filterName, setFilterName] = useState('');
const dataFiltered: UserProps[] = applyFilter({
const dataFiltered: EnvelopeProps[] = applyFilter({
inputData: _users,
comparator: getComparator(table.order, table.orderBy),
filterName,
@ -101,7 +101,7 @@ export function UserView() {
table.page * table.rowsPerPage + table.rowsPerPage
)
.map((row) => (
<UserTableRow
<EnvelopeTableRow
key={row.id}
row={row}
selected={table.selected.includes(row.id)}