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