From 4397a959e806bf476be4c81bc804616adf58b969 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 12 May 2021 22:42:12 +0200 Subject: ui: Migrate from CRA to Next.js This change updates the web frontend to use Next.js instead of Create React App (CRA). Next.js enables the possibility of rendering pages on the server side (which reduces the time to first frame) and overall provides a better development experience. Future commits will try to futher optimize the implementation for Next.js. --- opendc-web/opendc-web-ui/src/util/hooks.js | 29 ---------------------- opendc-web/opendc-web-ui/src/util/sidebar-space.js | 4 +-- 2 files changed, 2 insertions(+), 31 deletions(-) delete mode 100644 opendc-web/opendc-web-ui/src/util/hooks.js (limited to 'opendc-web/opendc-web-ui/src/util') diff --git a/opendc-web/opendc-web-ui/src/util/hooks.js b/opendc-web/opendc-web-ui/src/util/hooks.js deleted file mode 100644 index 7780a778..00000000 --- a/opendc-web/opendc-web-ui/src/util/hooks.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2021 AtLarge Research - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { useEffect } from 'react' - -export function useDocumentTitle(title) { - useEffect(() => { - document.title = title - }, [title]) -} diff --git a/opendc-web/opendc-web-ui/src/util/sidebar-space.js b/opendc-web/opendc-web-ui/src/util/sidebar-space.js index ef09d40a..005c40f3 100644 --- a/opendc-web/opendc-web-ui/src/util/sidebar-space.js +++ b/opendc-web/opendc-web-ui/src/util/sidebar-space.js @@ -1,2 +1,2 @@ -export const isCollapsible = (location) => - location.pathname.indexOf('portfolios') === -1 && location.pathname.indexOf('scenarios') === -1 +export const isCollapsible = (router) => + router.asPath.indexOf('portfolios') === -1 && router.asPath.indexOf('scenarios') === -1 -- cgit v1.2.3 From 53623fad76274e39206b8e073e371775ea96946b Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 17 May 2021 12:16:10 +0200 Subject: ui: Migrate to FontAwesome 5 React library This change updates the frontend to use the FontAwesome 5 React library that renders SVG icons as opposed to CSS icon fonts. This migration resolves a couple of issues we had with server-side rendering of the previous FontAwesome icons. --- opendc-web/opendc-web-ui/src/util/authorizations.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'opendc-web/opendc-web-ui/src/util') diff --git a/opendc-web/opendc-web-ui/src/util/authorizations.js b/opendc-web/opendc-web-ui/src/util/authorizations.js index 4086b35d..eb492d26 100644 --- a/opendc-web/opendc-web-ui/src/util/authorizations.js +++ b/opendc-web/opendc-web-ui/src/util/authorizations.js @@ -1,7 +1,9 @@ +import { faHome, faPencilAlt, faEye } from '@fortawesome/free-solid-svg-icons' + export const AUTH_ICON_MAP = { - OWN: 'home', - EDIT: 'pencil', - VIEW: 'eye', + OWN: faHome, + EDIT: faPencilAlt, + VIEW: faEye, } export const AUTH_DESCRIPTION_MAP = { -- cgit v1.2.3