mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
refactor: use locationSettings in application for date format
This commit is contained in:
parent
f58c284f70
commit
6f2e7be852
@ -11,10 +11,9 @@ import {
|
|||||||
} from '@material-ui/core';
|
} from '@material-ui/core';
|
||||||
import { Link as LinkIcon } from '@material-ui/icons';
|
import { Link as LinkIcon } from '@material-ui/icons';
|
||||||
import ConditionallyRender from '../common/ConditionallyRender/ConditionallyRender';
|
import ConditionallyRender from '../common/ConditionallyRender/ConditionallyRender';
|
||||||
// import {
|
import {
|
||||||
// formatFullDateTimeWithLocale,
|
formatDateWithLocale,
|
||||||
// formatDateWithLocale,
|
} from '../common/util';
|
||||||
// } from '../common/util';
|
|
||||||
import { UPDATE_APPLICATION } from '../providers/AccessProvider/permissions';
|
import { UPDATE_APPLICATION } from '../providers/AccessProvider/permissions';
|
||||||
import ApplicationView from './ApplicationView';
|
import ApplicationView from './ApplicationView';
|
||||||
import ApplicationUpdate from './ApplicationUpdate';
|
import ApplicationUpdate from './ApplicationUpdate';
|
||||||
@ -26,6 +25,7 @@ import AccessContext from '../../contexts/AccessContext';
|
|||||||
import useApplicationsApi from '../../hooks/api/actions/useApplicationsApi/useApplicationsApi';
|
import useApplicationsApi from '../../hooks/api/actions/useApplicationsApi/useApplicationsApi';
|
||||||
import useApplication from '../../hooks/api/getters/useApplication/useApplication';
|
import useApplication from '../../hooks/api/getters/useApplication/useApplication';
|
||||||
import { useHistory, useParams } from 'react-router-dom';
|
import { useHistory, useParams } from 'react-router-dom';
|
||||||
|
import { useLocationSettings } from '../../hooks/useLocationSettings';
|
||||||
|
|
||||||
const EditApplication = () => {
|
const EditApplication = () => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
@ -34,6 +34,9 @@ const EditApplication = () => {
|
|||||||
const { appName, url, description, icon = 'apps', createdAt } = application;
|
const { appName, url, description, icon = 'apps', createdAt } = application;
|
||||||
const { hasAccess } = useContext(AccessContext);
|
const { hasAccess } = useContext(AccessContext);
|
||||||
const { deleteApplication } = useApplicationsApi();
|
const { deleteApplication } = useApplicationsApi();
|
||||||
|
const { locationSettings } = useLocationSettings();
|
||||||
|
|
||||||
|
console.log(locationSettings)
|
||||||
|
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [showDialog, setShowDialog] = useState(false);
|
const [showDialog, setShowDialog] = useState(false);
|
||||||
@ -48,8 +51,8 @@ const EditApplication = () => {
|
|||||||
setShowDialog(!showDialog);
|
setShowDialog(!showDialog);
|
||||||
};
|
};
|
||||||
|
|
||||||
// missing the settings hook (locale)
|
const formatDate = (v: Date) =>
|
||||||
//const formatDate = v => formatDateWithLocale(v, locale);
|
formatDateWithLocale(v, locationSettings.locale);
|
||||||
|
|
||||||
const onDeleteApplication = async (evt: Event) => {
|
const onDeleteApplication = async (evt: Event) => {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
@ -134,8 +137,7 @@ const EditApplication = () => {
|
|||||||
<div>
|
<div>
|
||||||
<Typography variant="body1">{description || ''}</Typography>
|
<Typography variant="body1">{description || ''}</Typography>
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
{/* // need to use formatDate once we have the useSettings hook ready */}
|
Created: <strong>{formatDate(createdAt)}</strong>
|
||||||
Created: <strong>{createdAt}</strong>
|
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
|
@ -6,8 +6,6 @@ import Strategies from '../../page/strategies';
|
|||||||
import HistoryPage from '../../page/history';
|
import HistoryPage from '../../page/history';
|
||||||
import HistoryTogglePage from '../../page/history/toggle';
|
import HistoryTogglePage from '../../page/history/toggle';
|
||||||
import { ArchiveListContainer } from '../archive/ArchiveListContainer';
|
import { ArchiveListContainer } from '../archive/ArchiveListContainer';
|
||||||
import Applications from '../../page/applications';
|
|
||||||
import ApplicationView from '../../page/applications/view';
|
|
||||||
import ListTagTypes from '../../page/tag-types';
|
import ListTagTypes from '../../page/tag-types';
|
||||||
import Addons from '../../page/addons';
|
import Addons from '../../page/addons';
|
||||||
import AddonsCreate from '../../page/addons/create';
|
import AddonsCreate from '../../page/addons/create';
|
||||||
|
Loading…
Reference in New Issue
Block a user