diff --git a/client/.env.development b/client/.env.development index 23eb844..55b91be 100644 --- a/client/.env.development +++ b/client/.env.development @@ -1 +1,2 @@ -VITE_SHARELINK_API_BASE_URL=http://localhost:5160 \ No newline at end of file +VITE_SHARELINK_API_BASE_URL=http://localhost:5160 +VITE_MOCK_API=true \ No newline at end of file diff --git a/client/.env.production b/client/.env.production index cbb14fb..8ddb1b6 100644 --- a/client/.env.production +++ b/client/.env.production @@ -1 +1,2 @@ -VITE_SHARELINK_API_BASE_URL=https://sharelink-app.azurewebsites.net \ No newline at end of file +VITE_SHARELINK_API_BASE_URL=https://sharelink-app.azurewebsites.net +VITE_MOCK_API=true \ No newline at end of file diff --git a/client/src/App.tsx b/client/src/App.tsx index 6c9c3c7..ddd9bfe 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -8,6 +8,7 @@ import {useUserStore} from './contexts/AppContext.tsx'; import {observer} from 'mobx-react-lite'; import Footer from './components/Footer.tsx'; import Header from './components/Header.tsx'; +import MockApiWarning from './components/MockApiWarning.tsx'; const App = observer(() => { const [section, setSection] = useState<'list' | 'addLink'>('list'); @@ -21,6 +22,7 @@ const App = observer(() => {
+ <> diff --git a/client/src/components/MockApiWarning.tsx b/client/src/components/MockApiWarning.tsx new file mode 100644 index 0000000..0d9df51 --- /dev/null +++ b/client/src/components/MockApiWarning.tsx @@ -0,0 +1,18 @@ +import {useState} from 'react'; +import Modal from './Modal.tsx'; + +const MockApiWarning = () => { + const [showMockApiWarning, setShowMockApiWarning] = useState(import.meta.env.VITE_MOCK_API === 'true'); + + return <> + { showMockApiWarning && + setShowMockApiWarning(false)}> +
+

Server Offline

+

The server is currently offline to save costs. Displayed data is for example purposes only. For more information, please contact me at a.golub113@gmail.com.

+
+
+ }; +}; + +export default MockApiWarning; \ No newline at end of file diff --git a/client/src/components/Modal.tsx b/client/src/components/Modal.tsx index 42fe335..fc7be2f 100644 --- a/client/src/components/Modal.tsx +++ b/client/src/components/Modal.tsx @@ -13,7 +13,7 @@ const Modal = ({ children, onClose, priority }: ModalProps) => { return ( <> -
+