Skip to content

Commit

Permalink
Front-168. Change link on modal and fix logic spectrum app. (#936)
Browse files Browse the repository at this point in the history
* Changed link on modal and fixed logic view.

* fix: renamed variables and changed text on Splash modal.
  • Loading branch information
AntonovDm authored Jul 4, 2024
1 parent eb022eb commit fda2316
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 46 deletions.
16 changes: 7 additions & 9 deletions src/ApplicationRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { Modal } from '@ergolabs/ui-kit';
import { localStorageManager, Modal } from '@ergolabs/ui-kit';
import { fireAnalyticsEvent, getBrowser, user } from '@spectrumlabs/analytics';
import { DateTime } from 'luxon';
import { FC, useEffect } from 'react';
import { Navigate, Outlet, useRoutes } from 'react-router-dom';

import { version } from '../package.json';
import { NetworkDomManager } from './common/services/NetworkDomManager/NetworkDomManager';
import { localStorageManager } from './common/utils/localStorageManager.ts';
import { Layout } from './components/common/Layout/Layout';
import { PreSplashModal } from './components/PreSplashModal/PreSplashModal.tsx';
import { RouteConfigExtended } from './components/RouterTitle/RouteConfigExtended';
import { RouterTitle } from './components/RouterTitle/RouterTitle';
import { SplashModal } from './components/SplashModal/SplashModal.tsx';
import { useApplicationSettings } from './context';
import { AddLiquidity } from './pages/AddLiquidity/AddLiquidity';
import { CreatePool } from './pages/CreatePool/CreatePool';
Expand Down Expand Up @@ -143,8 +142,8 @@ export const ApplicationRoutes: FC = () => {

const [settings] = useApplicationSettings();

const openPreSplashModal = () =>
Modal.open(({ close }) => <PreSplashModal close={close} />);
const openSplashModal = () =>
Modal.open(({ close }) => <SplashModal close={close} />);

useEffect(() => {
fireAnalyticsEvent('App Loaded');
Expand All @@ -157,12 +156,11 @@ export const ApplicationRoutes: FC = () => {
}, []);

useEffect(() => {
const hasSeenInformModal = localStorageManager.get('hasSeenInformModal');
const network = localStorageManager.get('spectrum-selected-network-key');

if (!hasSeenInformModal) {
if (network !== 'ergo') {
const timer = setTimeout(() => {
openPreSplashModal();
localStorageManager.set('hasSeenInformModal', true);
openSplashModal();
}, 5000);

return () => clearTimeout(timer);
Expand Down
37 changes: 0 additions & 37 deletions src/components/PreSplashModal/PreSplashModal.tsx

This file was deleted.

47 changes: 47 additions & 0 deletions src/components/SplashModal/SplashModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Button, Flex, Modal, Typography, useDevice } from '@ergolabs/ui-kit';
import { Trans } from '@lingui/macro';
import { CSSProperties } from 'react';
import * as React from 'react';

export const SplashModal: React.FC<{ close: (result?: any) => void }> = ({
close,
}) => {
const { valBySize } = useDevice();

const handleClick = () => {
window.open('https://app.splash.trade', '_blank');
close();
};

return (
<>
<Modal.Title>
<Typography.Title level={3}>Product Update</Typography.Title>
</Modal.Title>
<Modal.Content width={valBySize<CSSProperties['width']>('100%', 480)}>
<Flex col gap={4}>
<Typography.Body>
Spectrum Cardano DEX will change its brand name to Splash soon.
<br />
All pools will be migrated to the Splash interface.
<br />
Funds will be accessible through the new interface.
</Typography.Body>
<Typography.Body strong>
This interface will be shut down on 1st Aug 2024.
</Typography.Body>
<Flex justify="center">
<Button
type="primary"
size="large"
width={'130px'}
onClick={handleClick}
>
<Trans>Go to Splash</Trans>
</Button>
</Flex>
</Flex>
</Modal.Content>
</>
);
};

0 comments on commit fda2316

Please sign in to comment.