Added ShortUrlStatus concept

This commit is contained in:
Alejandro Celaya
2022-12-18 19:26:30 +01:00
parent 99485cc6d8
commit d1a1b7426e
6 changed files with 105 additions and 40 deletions

View File

@@ -9,8 +9,7 @@ import { Time } from '../../utils/dates/Time';
import { ShortUrlVisitsCount } from './ShortUrlVisitsCount';
import { ShortUrlsRowMenuType } from './ShortUrlsRowMenu';
import { Tags } from './Tags';
import { shortUrlIsDisabled } from './index';
import { DisabledLabel } from './DisabledLabel';
import { ShortUrlStatus } from './ShortUrlStatus';
import './ShortUrlsRow.scss';
interface ShortUrlsRowProps {
@@ -27,7 +26,6 @@ export const ShortUrlsRow = (
const [copiedToClipboard, setCopiedToClipboard] = useTimeoutToggle();
const [active, setActive] = useTimeoutToggle(false, 500);
const isFirstRun = useRef(true);
const isDisabled = shortUrlIsDisabled(shortUrl);
useEffect(() => {
!isFirstRun.current && setActive();
@@ -39,6 +37,9 @@ export const ShortUrlsRow = (
<td className="indivisible short-urls-row__cell responsive-table__cell" data-th="Created at">
<Time date={shortUrl.dateCreated} />
</td>
<td className="responsive-table__cell short-urls-row__cell" data-th="Status">
<ShortUrlStatus shortUrl={shortUrl} />
</td>
<td className="responsive-table__cell short-urls-row__cell" data-th="Short URL">
<span className="position-relative short-urls-row__cell--indivisible">
<span className="short-urls-row__short-url-wrapper">
@@ -54,11 +55,6 @@ export const ShortUrlsRow = (
className="responsive-table__cell short-urls-row__cell short-urls-row__cell--break"
data-th={`${shortUrl.title ? 'Title' : 'Long URL'}`}
>
{isDisabled && (
<div className="float-end ms-2">
<DisabledLabel />
</div>
)}
<ExternalLink href={shortUrl.longUrl}>{shortUrl.title ?? shortUrl.longUrl}</ExternalLink>
</td>
{shortUrl.title && (