diff --git a/README.md b/README.md index aafe3c0f..f9afdeb1 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ _**On first login, new user must change password by using the `passwd` command** - ### Using Local Setup - Run `install.ps1` (recommended) or `install.bat` (legacy) or `install.sh` (on linux) to get dependencies set up locally - - `install.ps1` supports performing a clean installation by using the `-CleanInstall` flag. Use this if you encounter a `npm install` failure. Caution: Ensure you have commited/pushed any important changes before running this command. + - `install.ps1` supports performing a clean installation by using the `-CleanInstall` flag. Use this if you encounter a `npm install` failure. **Caution:** Ensure you have commited/pushed any important changes before running this command with the `-CleanInstall` flag. - `install.ps1` also supports skipping initializing the server or the ui, using the `-SkipServer` and `-SkipUI` flags. - You will need to manually install the Prettier extension on your IDE ([for VSCode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)) ([for IntelliJ](https://plugins.jetbrains.com/plugin/10456-prettier)). @@ -87,3 +87,18 @@ After sshing into the server, cd into either prod or test project. Then run resp ## Backend Documentation [Swagger Link](https://petstore.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2FRIT-Software-Engineering%2FRIT-SE-Senior-Project%2Frefs%2Fheads%2Fdev%2Fui%2Fpublic%2Fapi-docs%2Fserver_doc.yaml) + +## Content Editor + +The site includes a Content Editor that allows administrators to edit HTML fragments stored in the database. These fragments are used to render portions of the site such as the homepage panel, sponsor information, and the logged-in/logged-out footers. + +### Accessing the Content Editor +- Log into the site with an account that has admin privileges. +- Navigate to the Admin Tab -> Content Editor -> Page Editor + +### Editing Content +- The editor displays a list of named HTML blocks (e.g., `homePagePanel`, `sponsor`, `loggedInFooter`, `loggedOutFooter`). +- Select the block you want to edit. The existing HTML will be displayed in a text box. +- Make your changes directly in the editor. +- Click **Update HTML** to save your changes. The update is written directly into the database. +- Refresh the site to see your changes in action. diff --git a/server/server/database/test_data/page_html_dummy.sql b/server/server/database/test_data/page_html_dummy.sql index f3200264..8fe18ab7 100644 --- a/server/server/database/test_data/page_html_dummy.sql +++ b/server/server/database/test_data/page_html_dummy.sql @@ -1,5 +1,9 @@ -INSERT INTO page_html (name, html) VALUES -('homePagePanel', '
+INSERT INTO + page_html (name, html) +VALUES + ( + 'homePagePanel', + '

Overview

@@ -15,8 +19,11 @@ INSERT INTO page_html (name, html) VALUES inception through an entire software development lifecycle. The end result is a functional software tool ready for use by the sponsor''s organization.

-
'), -('sponsor', '
+
' + ), + ( + 'sponsor', + '

Become a Project Sponsor

@@ -213,4 +220,45 @@ INSERT INTO page_html (name, html) VALUES
- '); \ No newline at end of file + ' + ), + ( + 'loggedOutFooter', + "
+
+
+ Logo +
+
+

+ Department of Software Engineering
+ Golisano Building 70, Room 1690
+ 134 Lomb Memorial Drive
+ Rochester, NY 14623-5608 +

+
+ +
+
+

© " || strftime('%Y','now') || " Rochester Institute of Technology, All Rights Reserved

+
+
" +), +( + 'loggedInFooter', + "
+
+
+ +
+
+
" +); \ No newline at end of file diff --git a/test_cases/admin.md b/test_cases/admin.md index 0fe7e4dc..eef56094 100644 --- a/test_cases/admin.md +++ b/test_cases/admin.md @@ -120,5 +120,13 @@ 5. Upon successful updating of the HTMLs a little “Success!” should appear just above the “Update HTML” button ![Content Editor 5](images/contenteditor5.png) -6. To view these changes simply sign out of admin by using the developer sign in menu in the top right or press on the RIT logo in the top left. The UI routing should remain the same and the changes made to the HTML should be visible immediately. +6. To view these changes simply sign out of admin by using the developer sign in menu in the top right or press on the RIT logo in the top left. The UI routing should remain the same and the changes made to the HTML should be visible immediately after refreshing. ![Content Editor 6](images/contenteditor6.png) + +7. In addition to the overview and project sponsor sections, Content Editor includes two other editable sections: "loggedOutFooter" and "loggedInFooter". + ![Content Editor 7](images/contenteditor7.png) + +8. Just like with the Overview and Sponsor sections, you can edit the "loggedOutFooter" + and "loggedInFooter" HTML directly. After making your changes, click "Update HTML" + and check the footer on the corresponding page (signed in vs. signed out) to confirm + the updates appear. diff --git a/test_cases/images/contenteditor7.png b/test_cases/images/contenteditor7.png new file mode 100644 index 00000000..022f30a6 Binary files /dev/null and b/test_cases/images/contenteditor7.png differ diff --git a/ui/src/Assets/Golisano _College of_Computing_and_Information_Sciences_LOGO.jpg b/ui/public/assets/Golisano_College of_Computing_and_Information_Sciences_LOGO.jpg similarity index 100% rename from ui/src/Assets/Golisano _College of_Computing_and_Information_Sciences_LOGO.jpg rename to ui/public/assets/Golisano_College of_Computing_and_Information_Sciences_LOGO.jpg diff --git a/ui/public/assets/logo-dark.png b/ui/public/assets/logo-dark.png new file mode 100644 index 00000000..e3c33d89 Binary files /dev/null and b/ui/public/assets/logo-dark.png differ diff --git a/ui/public/assets/logo-light.png b/ui/public/assets/logo-light.png new file mode 100644 index 00000000..cf5ef1f8 Binary files /dev/null and b/ui/public/assets/logo-light.png differ diff --git a/ui/public/assets/logo.jpg b/ui/public/assets/logo.jpg new file mode 100644 index 00000000..d0f7f13d Binary files /dev/null and b/ui/public/assets/logo.jpg differ diff --git a/ui/src/components/pages/StackTraceErrorPage.js b/ui/src/components/pages/StackTraceErrorPage.js index a8b6ada8..b88a8c4d 100644 --- a/ui/src/components/pages/StackTraceErrorPage.js +++ b/ui/src/components/pages/StackTraceErrorPage.js @@ -1,4 +1,5 @@ import React, { useState } from "react"; +import uiConfig from "../../config/uiConfig"; import { Button } from "semantic-ui-react"; const StackTraceErrorPage = () => { @@ -33,7 +34,7 @@ const StackTraceErrorPage = () => { const handleReportOnGitHub = () => { try { - const version = "v1.8.1"; + const version = `v${uiConfig.footers.loggedIn.version}`; const timestamp = errorInfo?.timestamp || "No timestamp saved"; const error = errorInfo?.error || "Unknown error"; const statusCode = errorInfo?.statusCode diff --git a/ui/src/components/shared/allPages/Footer.js b/ui/src/components/shared/allPages/Footer.js index 15b29159..a4c26de4 100644 --- a/ui/src/components/shared/allPages/Footer.js +++ b/ui/src/components/shared/allPages/Footer.js @@ -1,94 +1,67 @@ import React, { useContext, useEffect, useState } from "react"; import { UserContext } from "../../util/functions/UserContext"; -import collegeLogo from "../../../Assets/Golisano _College of_Computing_and_Information_Sciences_LOGO.jpg"; +import { config } from "../../util/functions/constants"; +import { SecureFetch } from "../../util/functions/secureFetch"; +import InnerHTML from "dangerously-set-html-content"; import "./../../../css/containers/footer.css"; +import "semantic-ui-css/semantic.min.css" +import uiConfig from "../../../config/uiConfig"; function Footer() { const { user } = useContext(UserContext); - const [signedIn, setSignedIn] = useState(false); + const [footerHtml, setFooterHtml] = useState(""); + const [isLoading, setIsLoading] = useState(true); + const signedIn = user && Object.keys(user).length > 0 && user.user; useEffect(() => { - // A user is considered signed in if the user object has a value - setSignedIn(Object.keys(user).length !== 0); - }, [user]); - - if (signedIn) { - return ( - - ); - } else { + + const footerName = signedIn ? "loggedInFooter" : "loggedOutFooter"; + + setIsLoading(true); + SecureFetch(`${config.url.API_GET_HTML}?name=${footerName}`) + .then((r) => { + if (!r.ok) throw new Error("Network response was not ok"); + return r.json(); + }) + .then((data) => { + const html = data?.[0]?.html || ""; + setFooterHtml(html); + setIsLoading(false); + }) + .catch((error) => { + console.error("Error fetching footer:", error); + setFooterHtml(""); + setIsLoading(false); + }); + }, [user]); + if (isLoading) { return (