refactor: update is_active rendering to use 'Running' and 'Offline' labels

This commit is contained in:
2025-10-24 19:51:34 +07:00
parent 2abed31bde
commit a3e5fdd138
5 changed files with 62 additions and 28 deletions

View File

@@ -53,10 +53,18 @@ const columns = (showPreviewModal, showEditModal, showDeleteDialog) => [
key: 'is_active', key: 'is_active',
width: '10%', width: '10%',
align: 'center', align: 'center',
render: (status) => ( render: (_, { is_active }) => (
<Tag color={status ? '#23A55A' : 'red'} style={{ fontSize: '12px' }}> <>
{status ? 'Active' : 'Inactive'} {is_active === true ? (
</Tag> <Tag color={'green'} key={'status'}>
Running
</Tag>
) : (
<Tag color={'red'} key={'status'}>
Offline
</Tag>
)}
</>
), ),
}, },
{ {

View File

@@ -56,8 +56,18 @@ const columns = (showPreviewModal, showEditModal, showDeleteDialog) => [
key: 'is_active', key: 'is_active',
width: '15%', width: '15%',
align: 'center', align: 'center',
render: (status) => ( render: (_, { is_active }) => (
<Tag color={status ? 'green' : 'red'}>{status ? 'Active' : 'Inactive'}</Tag> <>
{is_active === true ? (
<Tag color={'green'} key={'status'}>
Running
</Tag>
) : (
<Tag color={'red'} key={'status'}>
Offline
</Tag>
)}
</>
), ),
}, },
{ {

View File

@@ -80,15 +80,19 @@ const columns = (showPreviewModal, showEditModal, showDeleteDialog) => [
key: 'is_active', key: 'is_active',
width: '8%', width: '8%',
align: 'center', align: 'center',
render: (_, { is_active }) => { render: (_, { is_active }) => (
const color = is_active ? 'green' : 'red'; <>
const text = is_active ? 'Active' : 'Inactive'; {is_active === true ? (
return ( <Tag color={'green'} key={'status'}>
<Tag color={color} key={'status'}> Running
{text} </Tag>
</Tag> ) : (
); <Tag color={'red'} key={'status'}>
}, Offline
</Tag>
)}
</>
),
}, },
{ {
title: 'Aksi', title: 'Aksi',

View File

@@ -45,15 +45,19 @@ const columns = (showPreviewModal, showEditModal, showDeleteDialog) => [
key: 'is_active', key: 'is_active',
width: '10%', width: '10%',
align: 'center', align: 'center',
render: (_, { is_active }) => { render: (_, { is_active }) => (
const color = is_active ? 'green' : 'red'; <>
const text = is_active ? 'Active' : 'Inactive'; {is_active === true ? (
return ( <Tag color={'green'} key={'status'}>
<Tag color={color} key={'status'}> Running
{text} </Tag>
</Tag> ) : (
); <Tag color={'red'} key={'status'}>
}, Offline
</Tag>
)}
</>
),
}, },
{ {
title: 'Aksi', title: 'Aksi',

View File

@@ -46,9 +46,17 @@ const columns = (showPreviewModal, showEditModal, showDeleteDialog) => [
width: '10%', width: '10%',
align: 'center', align: 'center',
render: (_, { is_active }) => ( render: (_, { is_active }) => (
<Tag color={is_active ? 'green' : 'red'} key={'status'}> <>
{is_active ? 'Active' : 'Inactive'} {is_active === true ? (
</Tag> <Tag color={'green'} key={'status'}>
Active
</Tag>
) : (
<Tag color={'default'} key={'status'}>
Inactive
</Tag>
)}
</>
), ),
}, },
{ {