🌐 Fix translation expiration date (125) (#136)
* 🌐 Fix translation expiration date (125)
This commit is contained in:
@@ -69,6 +69,10 @@ class LanguagesService extends Observable {
|
||||
this.notify();
|
||||
}
|
||||
|
||||
getLanguage(): string {
|
||||
return this.language;
|
||||
}
|
||||
|
||||
t(route: string, parameters: any[] = [], fallback?: string) {
|
||||
let replace: any = {};
|
||||
try {
|
||||
|
||||
@@ -72,7 +72,7 @@ export default (props: {
|
||||
}}
|
||||
size="sm"
|
||||
>
|
||||
Add
|
||||
{Languages.t('general.add')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+13
-1
@@ -8,12 +8,16 @@ import { Input } from 'app/atoms/input/input-text';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { AccessLevel } from './common';
|
||||
import moment from 'moment';
|
||||
import 'moment/min/locales'
|
||||
import Languages from 'features/global/services/languages-service';
|
||||
|
||||
|
||||
export const PublicLinkManager = ({ id, disabled }: { id: string; disabled?: boolean }) => {
|
||||
const { item, loading, update } = useDriveItem(id);
|
||||
const publicLink = getPublicLink(item);
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Base className="block mt-2 mb-1">{Languages.t('components.public-link-acess.public_link_acess')}</Base>
|
||||
@@ -115,6 +119,11 @@ const PublicLinkOptions = (props: {
|
||||
props.onChangeExpiration(useExpiration ? expiration : 0);
|
||||
}, [useExpiration, expiration]);
|
||||
|
||||
function expirationDate(exp: moment.MomentInput) {
|
||||
moment.locale(Languages.getLanguage());
|
||||
return moment(exp).fromNow(true).toLocaleString();
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Subtitle className="block mt-4 mb-1">{Languages.t('components.public-link-security')}</Subtitle>
|
||||
@@ -156,6 +165,9 @@ const PublicLinkOptions = (props: {
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center justify-center w-full h-10">
|
||||
|
||||
|
||||
|
||||
<Checkbox
|
||||
disabled={props.disabled}
|
||||
onChange={s => {
|
||||
@@ -169,7 +181,7 @@ const PublicLinkOptions = (props: {
|
||||
<Info className="ml-2 text-red-500">({Languages.t('components.public-link-security_expired')})</Info>
|
||||
)}
|
||||
{useExpiration && (expiration || 0) > Date.now() && (
|
||||
<Info className="ml-2">({moment(expiration).fromNow(true).toLocaleString()})</Info>
|
||||
<Info className="ml-2">({expirationDate(expiration)})</Info>
|
||||
)}{' '}
|
||||
<div className="grow mr-2" />
|
||||
{!!useExpiration && (
|
||||
|
||||
Reference in New Issue
Block a user