rename opened document history

This commit is contained in:
smanylov
2026-05-13 12:15:11 +07:00
parent 294e16e1a6
commit 9c011b6416
3 changed files with 35 additions and 7 deletions
@@ -63,6 +63,16 @@ export function TrackingHistoryView() {
return nameWithoutExtension.substring(0, maxNameLength) + '...';
}
const editLocationName = (location: string | undefined | null, place: 'city' | 'country') => {
let notDefinedPlace = (place === 'city') ? t('not-defined-city') : t('not-defined-country');
location === 'UNKNOWN' ? notDefinedPlace : location;
let response = notDefinedPlace;
if (location !== 'UNKNOWN' && location !== undefined && location !== null) {
response = location;
}
return response;
}
const columns = useMemo<ColumnDef<HistoryViewItem>[]>(
() => [
{
@@ -103,7 +113,7 @@ export function TrackingHistoryView() {
header: ({ column }) => (
<div className="column">
<span>
Дата / время
{t('date')} / {t('time')}
</span>
<button
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
@@ -148,7 +158,7 @@ export function TrackingHistoryView() {
header: ({ column }) => (
<div className="column">
<span>
viewer
{t('who-opened')}
</span>
<button
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
@@ -183,7 +193,7 @@ export function TrackingHistoryView() {
header: ({ column }) => (
<div className="column">
<span>
Местоположение
{t('location')}
</span>
<button
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
@@ -208,7 +218,11 @@ export function TrackingHistoryView() {
cell: ({ row }) => {
return (
<div className="text-center font-semibold table-item">
{row.original.city} {row.original.country}
{row.original.city === 'UNKNOWN' && row.original.country === 'UNKNOWN' ? (
t('not-defined')
) : (
`${editLocationName(row.original.city, 'city')} / ${editLocationName(row.original.country, 'country')}`
)}
</div>
)
},
@@ -254,7 +268,7 @@ export function TrackingHistoryView() {
<h3
className="tanstak-table-title"
>
История открытий
{t('history-of-opened')}
</h3>
{/* Фильтры */}
<div className="tanstak-table-filtres">