From c0072dea3add1de8510fbaaff60ed9989cad15df Mon Sep 17 00:00:00 2001 From: rpaigemei Date: Thu, 2 Nov 2023 14:16:16 -0400 Subject: [PATCH 01/29] navigate to gallery page --- client/src/App.jsx | 2 + client/src/components/NavBar/NavBar.jsx | 12 +++++ .../src/components/NavBar/NavBarConfig.json | 3 +- client/src/views/Gallery/Gallery.jsx | 17 ++++++ client/src/views/Gallery/gallery.less | 54 +++++++++++++++++++ .../1.0.0/full_documentation.json | 2 +- 6 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 client/src/views/Gallery/Gallery.jsx create mode 100644 client/src/views/Gallery/gallery.less diff --git a/client/src/App.jsx b/client/src/App.jsx index 3efe80918..56236c198 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -2,6 +2,7 @@ import React from 'react'; import { Route, Routes } from 'react-router-dom'; import PrivateRoute from './Utils/PrivateRoute'; import About from './views/About/About'; +import Gallery from './views/Gallery/Gallery'; import BlocklyPage from './views/BlocklyPage/BlocklyPage'; import BugReport from './views/BugReport/BugReport'; import ContentCreator from './views/ContentCreator/ContentCreator'; @@ -32,6 +33,7 @@ const App = () => { } /> } /> } /> + } /> ) : null} + {shouldShowRoute('Sandbox') ? ( + { + localStorage.removeItem('sandbox-activity'); + handleRouteChange(routes.Gallery); + }} + > + +   Gallery + + ) : null} {shouldShowRoute('TeacherLogin') ? ( + +
+ +
+ + ) +} diff --git a/client/src/views/Gallery/gallery.less b/client/src/views/Gallery/gallery.less new file mode 100644 index 000000000..860c52420 --- /dev/null +++ b/client/src/views/Gallery/gallery.less @@ -0,0 +1,54 @@ +@import "../../assets/style.less"; + +.container { + background-color: #colors[primary]; + height: 100%; + min-height: 100vh; + width: 100%; + min-width: 100vw; + text-align: center; +} + +#about-content-container { + margin: 8vh auto 5vh auto; + padding: 5vh 5vw; + width: 80vw; + background: #colors[tertiary]; + border-radius: 20px; + border: 2px solid #colors[secondary]; + + #logos { + width: 50vw; + margin: auto; + + img { + width: 20%; + height: auto; + margin: auto; + } + } + + #title { + font-size: 3em; + color: #colors[text-primary]; + margin-bottom: 0; + } + + #secondary-title { + font-size: 2em; + color: #colors[text-primary]; + } + + #divider { + width: 95%; + height: 0; + margin: 5vh 0; + border-bottom: 1px solid #colors[secondary]; + opacity: 20%; + } + + p { + font-size: 1.5em; + color: #colors[text-primary]; + } +} \ No newline at end of file diff --git a/server/extensions/documentation/documentation/1.0.0/full_documentation.json b/server/extensions/documentation/documentation/1.0.0/full_documentation.json index 49963424f..c23879f5f 100755 --- a/server/extensions/documentation/documentation/1.0.0/full_documentation.json +++ b/server/extensions/documentation/documentation/1.0.0/full_documentation.json @@ -14,7 +14,7 @@ "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "x-generation-date": "10/12/2023 1:28:43 PM" + "x-generation-date": "11/01/2023 7:34:47 PM" }, "x-strapi-config": { "path": "/documentation", From b03f7bd0fa47d300ab7e7f5789b157a6e9acbd1e Mon Sep 17 00:00:00 2001 From: rpaigemei Date: Thu, 2 Nov 2023 15:21:21 -0400 Subject: [PATCH 02/29] search bar and icon --- client/src/components/NavBar/NavBar.jsx | 5 ++-- client/src/components/NavBar/NavBar.less | 4 +-- .../src/components/NavBar/NavBarConfig.json | 2 +- client/src/components/Search/Search.jsx | 30 +++++++++++++++++++ client/src/components/Search/Search.less | 8 +++++ client/src/views/Gallery/Gallery.jsx | 9 +++--- 6 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 client/src/components/Search/Search.jsx create mode 100644 client/src/components/Search/Search.less diff --git a/client/src/components/NavBar/NavBar.jsx b/client/src/components/NavBar/NavBar.jsx index 1bfaa04db..77217e7e6 100644 --- a/client/src/components/NavBar/NavBar.jsx +++ b/client/src/components/NavBar/NavBar.jsx @@ -72,15 +72,14 @@ export default function NavBar() {   Sandbox
) : null} - {shouldShowRoute('Sandbox') ? ( + {shouldShowRoute('Gallery') ? ( { - localStorage.removeItem('sandbox-activity'); handleRouteChange(routes.Gallery); }} > - +   Gallery ) : null} diff --git a/client/src/components/NavBar/NavBar.less b/client/src/components/NavBar/NavBar.less index c4a52366a..f968a88c6 100644 --- a/client/src/components/NavBar/NavBar.less +++ b/client/src/components/NavBar/NavBar.less @@ -14,9 +14,7 @@ background-color: #colors[primary]; padding-right: 2vw; - -moz-box-shadow: 0 1px 5px -1px darken(#colors[primary], 90%); - -webkit-box-shadow: 0 1px 5px -1px darken(#colors[primary], 90%); - box-shadow: 0 1px 5px -1px darken(#colors[primary], 90%); + box-shadow: 0 1px 5px -1px; #link { #casmm-logo { diff --git a/client/src/components/NavBar/NavBarConfig.json b/client/src/components/NavBar/NavBarConfig.json index 050b2390d..d2a8f9f17 100644 --- a/client/src/components/NavBar/NavBarConfig.json +++ b/client/src/components/NavBar/NavBarConfig.json @@ -13,7 +13,7 @@ "Gallery": "/gallery" }, "users": { - "DefaultUser": ["Home", "TeacherLogin", "Sandbox", "About"], + "DefaultUser": ["Home", "TeacherLogin", "Sandbox", "About", "Gallery"], "Mentor": ["Dashboard", "AccountInfo", "SignOut", "Sandbox", "BugReport"], "Student": ["SignOut"], "ContentCreator": [ diff --git a/client/src/components/Search/Search.jsx b/client/src/components/Search/Search.jsx new file mode 100644 index 000000000..f4704bda7 --- /dev/null +++ b/client/src/components/Search/Search.jsx @@ -0,0 +1,30 @@ +import './Search.less' + +import React from 'react'; +import { useRef } from "react"; + +function Search() { + const input = useRef(); + + function handleChange() { + // TODO: Update the value of the filter with the input from the textbox + // Hint: You will need to use the "current" property of the input variable + // console.log("handleChange called"); + filterUpdate(input.current.value); + } + + return ( + // TODO: Add a ref attribute to the input tag + // TODO: Add an onChange attribute to the input tag +
+ +
+ ); +} +export default Search; \ No newline at end of file diff --git a/client/src/components/Search/Search.less b/client/src/components/Search/Search.less new file mode 100644 index 000000000..e7fc5acff --- /dev/null +++ b/client/src/components/Search/Search.less @@ -0,0 +1,8 @@ +.searchBar { + margin: 5px; + font-size: 1.2rem; + border-radius: 10px; + padding: 5px; + display: flex; + width: 100%; +} \ No newline at end of file diff --git a/client/src/views/Gallery/Gallery.jsx b/client/src/views/Gallery/Gallery.jsx index 009757f66..08dbc33a2 100644 --- a/client/src/views/Gallery/Gallery.jsx +++ b/client/src/views/Gallery/Gallery.jsx @@ -1,16 +1,15 @@ import React from "react" -import NSF from "../../assets/nsf_logo.png" -import TAMU from "../../assets/tamu_logo.png" -import UF from "../../assets/uf_logo.png" import NavBar from "../../components/NavBar/NavBar" -import "./gallery.less" +import Search from "../../components/Search/Search" +import "./Gallery.less" export default function Gallery(props) { return (
- +

Public Gallery

+
) From 7eedce3676f453b6efac5e5ed52437eb9f5fe2b5 Mon Sep 17 00:00:00 2001 From: 100472150 <100472150@alumnos.uc3m.es> Date: Thu, 2 Nov 2023 15:34:04 -0400 Subject: [PATCH 03/29] v0 --- .../documentation/documentation/1.0.0/full_documentation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/extensions/documentation/documentation/1.0.0/full_documentation.json b/server/extensions/documentation/documentation/1.0.0/full_documentation.json index 49963424f..beb56ba42 100755 --- a/server/extensions/documentation/documentation/1.0.0/full_documentation.json +++ b/server/extensions/documentation/documentation/1.0.0/full_documentation.json @@ -14,7 +14,7 @@ "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "x-generation-date": "10/12/2023 1:28:43 PM" + "x-generation-date": "11/02/2023 5:20:16 PM" }, "x-strapi-config": { "path": "/documentation", From a7c99726c635bf74918bb1e45ca2ab26df7e8245 Mon Sep 17 00:00:00 2001 From: Max Plummer Date: Fri, 3 Nov 2023 14:07:52 -0400 Subject: [PATCH 04/29] something --- client/src/App.jsx | 196 +++++++++--------- client/src/components/NavBar/NavBar.jsx | 186 +++++++++-------- .../src/components/NavBar/NavBarConfig.json | 5 +- 3 files changed, 201 insertions(+), 186 deletions(-) diff --git a/client/src/App.jsx b/client/src/App.jsx index 3efe80918..8f7df339a 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -2,6 +2,7 @@ import React from 'react'; import { Route, Routes } from 'react-router-dom'; import PrivateRoute from './Utils/PrivateRoute'; import About from './views/About/About'; +import Gallery from './views/Gallery/Gallery'; import BlocklyPage from './views/BlocklyPage/BlocklyPage'; import BugReport from './views/BugReport/BugReport'; import ContentCreator from './views/ContentCreator/ContentCreator'; @@ -21,102 +22,103 @@ import ResetPassword from './views/TeacherLogin/ResetPassword'; import TeacherLogin from './views/TeacherLogin/TeacherLogin'; const App = () => { - return ( -
- - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - } /> - } /> - -
- ); + return ( +
+ + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + } /> + } /> + +
+ ); }; -export default App; +export default App; \ No newline at end of file diff --git a/client/src/components/NavBar/NavBar.jsx b/client/src/components/NavBar/NavBar.jsx index 3896c3159..d43fa276f 100644 --- a/client/src/components/NavBar/NavBar.jsx +++ b/client/src/components/NavBar/NavBar.jsx @@ -29,102 +29,114 @@ export default function NavBar() { }; const menu = ( - - {shouldShowRoute('Home') ? ( - handleRouteChange(routes.Home)}> - -   Home - - ) : null} - {shouldShowRoute('Dashboard') ? ( - handleRouteChange(routes.Dashboard)}> - -   Dashboard - - ) : null} - {shouldShowRoute('ContentCreatorDashboard') ? ( - handleRouteChange(routes.ContentCreatorDashboard)} - > - -   Dashboard - - ) : null} - {shouldShowRoute('ResearcherDashboard') ? ( - handleRouteChange(routes.ResearcherDashboard)} - > - -   Dashboard - - ) : null} - {shouldShowRoute('Sandbox') ? ( - { - localStorage.removeItem('sandbox-activity'); - handleRouteChange(routes.Sandbox); - }} - > - -   Sandbox - - ) : null} - {shouldShowRoute('TeacherLogin') ? ( - handleRouteChange(routes.TeacherLogin)} - > - -   User Login - - ) : null} - {shouldShowRoute('About') ? ( - handleRouteChange(routes.About)}> - -   About - - ) : null} - {shouldShowRoute('BugReport') ? ( - handleRouteChange(routes.BugReport)}> - -   Report a Bug - - ) : null} - {shouldShowRoute('SignOut') ? ( - handleLogout()}> - -   Sign Out - - ) : null} - + + {shouldShowRoute('Home') ? ( + handleRouteChange(routes.Home)}> + +   Home + + ) : null} + {shouldShowRoute('Dashboard') ? ( + handleRouteChange(routes.Dashboard)}> + +   Dashboard + + ) : null} + {shouldShowRoute('ContentCreatorDashboard') ? ( + handleRouteChange(routes.ContentCreatorDashboard)} + > + +   Dashboard + + ) : null} + {shouldShowRoute('ResearcherDashboard') ? ( + handleRouteChange(routes.ResearcherDashboard)} + > + +   Dashboard + + ) : null} + {shouldShowRoute('Sandbox') ? ( + { + localStorage.removeItem('sandbox-activity'); + handleRouteChange(routes.Sandbox); + }} + > + +   Sandbox + + ) : null} + {shouldShowRoute('Sandbox') ? ( + { + localStorage.removeItem('sandbox-activity'); + handleRouteChange(routes.Gallery); + }} + > + +   Gallery + + ) : null} + {shouldShowRoute('TeacherLogin') ? ( + handleRouteChange(routes.TeacherLogin)} + > + +   User Login + + ) : null} + {shouldShowRoute('About') ? ( + handleRouteChange(routes.About)}> + +   About + + ) : null} + {shouldShowRoute('BugReport') ? ( + handleRouteChange(routes.BugReport)}> + +   Report a Bug + + ) : null} + {shouldShowRoute('SignOut') ? ( + handleLogout()}> + +   Sign Out + + ) : null} + ); return ( - + ); -} +} \ No newline at end of file diff --git a/client/src/components/NavBar/NavBarConfig.json b/client/src/components/NavBar/NavBarConfig.json index 27282d536..fe6b32bf4 100644 --- a/client/src/components/NavBar/NavBarConfig.json +++ b/client/src/components/NavBar/NavBarConfig.json @@ -9,7 +9,8 @@ "AccountInfo": "/account", "ContentCreatorDashboard": "/ccdashboard", "ResearcherDashboard": "/report", - "BugReport": "/bugreport" + "BugReport": "/bugreport", + "Gallery": "/gallery" }, "users": { "DefaultUser": ["Home", "TeacherLogin", "Sandbox", "About"], @@ -24,4 +25,4 @@ ], "Researcher": ["ResearcherDashboard", "BugReport", "SignOut"] } -} +} \ No newline at end of file From 31ae8abf28239d580af69f9fdb588655dd180165 Mon Sep 17 00:00:00 2001 From: Max Plummer Date: Fri, 3 Nov 2023 14:08:58 -0400 Subject: [PATCH 05/29] something else --- client/src/views/Gallery/Gallery.jsx | 17 +++++++++ client/src/views/Gallery/gallery.less | 54 +++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 client/src/views/Gallery/Gallery.jsx create mode 100644 client/src/views/Gallery/gallery.less diff --git a/client/src/views/Gallery/Gallery.jsx b/client/src/views/Gallery/Gallery.jsx new file mode 100644 index 000000000..83e92a446 --- /dev/null +++ b/client/src/views/Gallery/Gallery.jsx @@ -0,0 +1,17 @@ +import React from "react" +import NSF from "../../assets/nsf_logo.png" +import TAMU from "../../assets/tamu_logo.png" +import UF from "../../assets/uf_logo.png" +import NavBar from "../../components/NavBar/NavBar" +import "./gallery.less" + +export default function Gallery(props) { + return ( +
+ +
+ +
+
+ ) +} \ No newline at end of file diff --git a/client/src/views/Gallery/gallery.less b/client/src/views/Gallery/gallery.less new file mode 100644 index 000000000..860c52420 --- /dev/null +++ b/client/src/views/Gallery/gallery.less @@ -0,0 +1,54 @@ +@import "../../assets/style.less"; + +.container { + background-color: #colors[primary]; + height: 100%; + min-height: 100vh; + width: 100%; + min-width: 100vw; + text-align: center; +} + +#about-content-container { + margin: 8vh auto 5vh auto; + padding: 5vh 5vw; + width: 80vw; + background: #colors[tertiary]; + border-radius: 20px; + border: 2px solid #colors[secondary]; + + #logos { + width: 50vw; + margin: auto; + + img { + width: 20%; + height: auto; + margin: auto; + } + } + + #title { + font-size: 3em; + color: #colors[text-primary]; + margin-bottom: 0; + } + + #secondary-title { + font-size: 2em; + color: #colors[text-primary]; + } + + #divider { + width: 95%; + height: 0; + margin: 5vh 0; + border-bottom: 1px solid #colors[secondary]; + opacity: 20%; + } + + p { + font-size: 1.5em; + color: #colors[text-primary]; + } +} \ No newline at end of file From 9aaa8eee10c98877f34fa702c622c575afbc42c8 Mon Sep 17 00:00:00 2001 From: Max Plummer Date: Fri, 3 Nov 2023 14:23:37 -0400 Subject: [PATCH 06/29] NavBar updated to direct to Gallery/Search page --- client/src/App.jsx | 100 -------- client/src/components/NavBar/NavBar.jsx | 308 ++++++++--------------- client/src/components/Search/Search.jsx | 38 +-- client/src/components/Search/Search.less | 2 +- client/src/views/Gallery/Gallery.jsx | 29 +-- 5 files changed, 136 insertions(+), 341 deletions(-) diff --git a/client/src/App.jsx b/client/src/App.jsx index 14e18662f..8f7df339a 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -22,7 +22,6 @@ import ResetPassword from './views/TeacherLogin/ResetPassword'; import TeacherLogin from './views/TeacherLogin/TeacherLogin'; const App = () => { -<<<<<<< HEAD return (
@@ -120,105 +119,6 @@ const App = () => {
); -======= - return ( -
- - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - } /> - } /> - -
- ); ->>>>>>> origin/paige }; export default App; \ No newline at end of file diff --git a/client/src/components/NavBar/NavBar.jsx b/client/src/components/NavBar/NavBar.jsx index 4beddf5f0..6961a5ffe 100644 --- a/client/src/components/NavBar/NavBar.jsx +++ b/client/src/components/NavBar/NavBar.jsx @@ -9,210 +9,124 @@ import { removeUserSession } from '../../Utils/AuthRequests'; import { useGlobalState } from '../../Utils/userState'; export default function NavBar() { - const [value] = useGlobalState('currUser'); - let currentRoute = window.location.pathname; - let navigate = useNavigate(); - let routes = config.routes; + const [value] = useGlobalState('currUser'); + let currentRoute = window.location.pathname; + let navigate = useNavigate(); + let routes = config.routes; - const handleLogout = () => { - removeUserSession(); - navigate('/'); - }; + const handleLogout = () => { + removeUserSession(); + navigate('/'); + }; - const handleRouteChange = (route) => { - navigate(route); - }; + const handleRouteChange = (route) => { + navigate(route); + }; - const shouldShowRoute = (route) => { - if (currentRoute === routes[route]) return false; - return config.users[value.role].includes(route); - }; + const shouldShowRoute = (route) => { + if (currentRoute === routes[route]) return false; + return config.users[value.role].includes(route); + }; - const menu = ( -<<<<<<< HEAD - - {shouldShowRoute('Home') ? ( - handleRouteChange(routes.Home)}> - -   Home - - ) : null} - {shouldShowRoute('Dashboard') ? ( - handleRouteChange(routes.Dashboard)}> - -   Dashboard - - ) : null} - {shouldShowRoute('ContentCreatorDashboard') ? ( - handleRouteChange(routes.ContentCreatorDashboard)} - > - -   Dashboard - - ) : null} - {shouldShowRoute('ResearcherDashboard') ? ( - handleRouteChange(routes.ResearcherDashboard)} - > - -   Dashboard - - ) : null} - {shouldShowRoute('Sandbox') ? ( - { - localStorage.removeItem('sandbox-activity'); - handleRouteChange(routes.Sandbox); - }} - > - -   Sandbox - - ) : null} - {shouldShowRoute('Sandbox') ? ( - { - localStorage.removeItem('sandbox-activity'); - handleRouteChange(routes.Gallery); - }} - > - -   Gallery - - ) : null} - {shouldShowRoute('TeacherLogin') ? ( - handleRouteChange(routes.TeacherLogin)} - > - -   User Login - - ) : null} - {shouldShowRoute('About') ? ( - handleRouteChange(routes.About)}> - -   About - - ) : null} - {shouldShowRoute('BugReport') ? ( - handleRouteChange(routes.BugReport)}> - -   Report a Bug - - ) : null} - {shouldShowRoute('SignOut') ? ( - handleLogout()}> - -   Sign Out - - ) : null} - -======= - - {shouldShowRoute('Home') ? ( - handleRouteChange(routes.Home)}> - -   Home - - ) : null} - {shouldShowRoute('Dashboard') ? ( - handleRouteChange(routes.Dashboard)}> - -   Dashboard - - ) : null} - {shouldShowRoute('ContentCreatorDashboard') ? ( - handleRouteChange(routes.ContentCreatorDashboard)} - > - -   Dashboard - - ) : null} - {shouldShowRoute('ResearcherDashboard') ? ( - handleRouteChange(routes.ResearcherDashboard)} - > - -   Dashboard - - ) : null} - {shouldShowRoute('Sandbox') ? ( - { - localStorage.removeItem('sandbox-activity'); - handleRouteChange(routes.Sandbox); - }} - > - -   Sandbox - - ) : null} - {shouldShowRoute('Gallery') ? ( - { - handleRouteChange(routes.Gallery); - }} - > - -   Gallery - - ) : null} - {shouldShowRoute('TeacherLogin') ? ( - handleRouteChange(routes.TeacherLogin)} - > - -   User Login - - ) : null} - {shouldShowRoute('About') ? ( - handleRouteChange(routes.About)}> - -   About - - ) : null} - {shouldShowRoute('BugReport') ? ( - handleRouteChange(routes.BugReport)}> - -   Report a Bug - - ) : null} - {shouldShowRoute('SignOut') ? ( - handleLogout()}> - -   Sign Out - - ) : null} - ->>>>>>> origin/paige - ); + const menu = ( + + {shouldShowRoute('Home') ? ( + handleRouteChange(routes.Home)}> + +   Home + + ) : null} + {shouldShowRoute('Dashboard') ? ( + handleRouteChange(routes.Dashboard)}> + +   Dashboard + + ) : null} + {shouldShowRoute('ContentCreatorDashboard') ? ( + handleRouteChange(routes.ContentCreatorDashboard)} + > + +   Dashboard + + ) : null} + {shouldShowRoute('ResearcherDashboard') ? ( + handleRouteChange(routes.ResearcherDashboard)} + > + +   Dashboard + + ) : null} + {shouldShowRoute('Sandbox') ? ( + { + localStorage.removeItem('sandbox-activity'); + handleRouteChange(routes.Sandbox); + }} + > + +   Sandbox + + ) : null} + {shouldShowRoute('Gallery') ? ( + { + handleRouteChange(routes.Gallery); + }} + > + +   Gallery + + ) : null} + {shouldShowRoute('TeacherLogin') ? ( + handleRouteChange(routes.TeacherLogin)} + > + +   User Login + + ) : null} + {shouldShowRoute('About') ? ( + handleRouteChange(routes.About)}> + +   About + + ) : null} + {shouldShowRoute('BugReport') ? ( + handleRouteChange(routes.BugReport)}> + +   Report a Bug + + ) : null} + {shouldShowRoute('SignOut') ? ( + handleLogout()}> + +   Sign Out + + ) : null} + + ); - return ( - + return ( + @@ -228,5 +142,5 @@ export default function NavBar() { - ); + ); } \ No newline at end of file diff --git a/client/src/components/Search/Search.jsx b/client/src/components/Search/Search.jsx index f4704bda7..93fd3de29 100644 --- a/client/src/components/Search/Search.jsx +++ b/client/src/components/Search/Search.jsx @@ -6,25 +6,25 @@ import { useRef } from "react"; function Search() { const input = useRef(); - function handleChange() { - // TODO: Update the value of the filter with the input from the textbox - // Hint: You will need to use the "current" property of the input variable - // console.log("handleChange called"); - filterUpdate(input.current.value); - } + function handleChange() { + // TODO: Update the value of the filter with the input from the textbox + // Hint: You will need to use the "current" property of the input variable + // console.log("handleChange called"); + filterUpdate(input.current.value); + } - return ( - // TODO: Add a ref attribute to the input tag - // TODO: Add an onChange attribute to the input tag -
- -
- ); + return ( + // TODO: Add a ref attribute to the input tag + // TODO: Add an onChange attribute to the input tag +
+ +
+ ); } export default Search; \ No newline at end of file diff --git a/client/src/components/Search/Search.less b/client/src/components/Search/Search.less index e7fc5acff..8a53eac34 100644 --- a/client/src/components/Search/Search.less +++ b/client/src/components/Search/Search.less @@ -1,6 +1,6 @@ .searchBar { margin: 5px; - font-size: 1.2rem; + font-size: 1.2rem; border-radius: 10px; padding: 5px; display: flex; diff --git a/client/src/views/Gallery/Gallery.jsx b/client/src/views/Gallery/Gallery.jsx index b00844b02..e693e3d8b 100644 --- a/client/src/views/Gallery/Gallery.jsx +++ b/client/src/views/Gallery/Gallery.jsx @@ -1,35 +1,16 @@ import React from "react" -<<<<<<< HEAD -import NSF from "../../assets/nsf_logo.png" -import TAMU from "../../assets/tamu_logo.png" -import UF from "../../assets/uf_logo.png" import NavBar from "../../components/NavBar/NavBar" -import "./gallery.less" +import Search from "../../components/Search/Search" +import "./Gallery.less" export default function Gallery(props) { return (
- +

Public Gallery

+
) -} -======= -import NavBar from "../../components/NavBar/NavBar" -import Search from "../../components/Search/Search" -import "./Gallery.less" - -export default function Gallery(props) { - return ( -
- -
-

Public Gallery

- -
-
- ) -} ->>>>>>> origin/paige +} \ No newline at end of file From b70dad3b12cc0895dce29d57696bc0200a65c2eb Mon Sep 17 00:00:00 2001 From: rpaigemei Date: Fri, 3 Nov 2023 15:00:01 -0400 Subject: [PATCH 07/29] saved workspaces -> gallery --- .../components/GalleryView/GalleryView.jsx | 123 ++++++++++++++++++ client/src/views/Gallery/Gallery.jsx | 17 +++ 2 files changed, 140 insertions(+) create mode 100644 client/src/components/GalleryView/GalleryView.jsx diff --git a/client/src/components/GalleryView/GalleryView.jsx b/client/src/components/GalleryView/GalleryView.jsx new file mode 100644 index 000000000..b67d39f4e --- /dev/null +++ b/client/src/components/GalleryView/GalleryView.jsx @@ -0,0 +1,123 @@ +import React, { useState, useEffect } from 'react'; +import { Table, Popconfirm, message } from 'antd'; +import { QuestionCircleOutlined } from '@ant-design/icons'; +import { Link } from 'react-router-dom'; +import { + getAuthorizedWorkspaces, + getSubmission, + deleteAuthorizedWorkspace, + } from '../../Utils/requests'; + + +export default function GalleryView({searchParams, setSearchParams, classroomId}){ + const [workspaceList, setWorkspaceList] = useState([]); + const [tab, setTab] = useState( + searchParams.has('tab') ? searchParams.get('tab') : 'home' + ); + const [page, setPage] = useState( + searchParams.has('page') ? parseInt(searchParams.get('page')) : 1 + ); + useEffect(() => { + const fetchData = async () => { + let wsResponse; + if(classroomId){ + wsResponse = await getClassroomWorkspace(classroomId); + } + else{ + wsResponse = await getAuthorizedWorkspaces(); + } + + setWorkspaceList(wsResponse.data); + }; + fetchData(); + }, [classroomId]); + + const wsColumn = [ + { + title: 'Name', + dataIndex: 'name', + key: 'name', + editable: true, + width: '30%', + align: 'left', + render: (_, key) => key.name, + }, + { + title: 'Description', + dataIndex: 'description', + key: 'description', + editable: true, + width: '40%', + align: 'left', + render: (_, key) => key.description, + }, + { + title: 'Open Workspace', + dataIndex: 'open', + key: 'open', + editable: false, + width: '20%', + align: 'left', + render: (_, key) => ( + + localStorage.setItem('sandbox-activity', JSON.stringify(key)) + } + to={'/sandbox'} + > + Open + + ), + }, + { + title: 'Delete', + dataIndex: 'delete', + key: 'delete', + width: '10%', + align: 'right', + render: (_, key) => ( + } + onConfirm={async () => { + const res = await deleteAuthorizedWorkspace(key.id); + if (res.err) { + message.error(res.err); + } else { + setWorkspaceList( + workspaceList.filter((ws) => { + return ws.id !== key.id; + }) + ); + message.success('Delete success'); + } + }} + > + + + ), + }, + ]; + + + return ( +
+
+ { + setPage(Pagination.current); + setSearchParams({ tab, page: Pagination.current }); + }} + pagination={{ current: page ? page : 1 }} + >
+
+
+ ) +} \ No newline at end of file diff --git a/client/src/views/Gallery/Gallery.jsx b/client/src/views/Gallery/Gallery.jsx index 08dbc33a2..696a5d622 100644 --- a/client/src/views/Gallery/Gallery.jsx +++ b/client/src/views/Gallery/Gallery.jsx @@ -1,15 +1,32 @@ import React from "react" import NavBar from "../../components/NavBar/NavBar" import Search from "../../components/Search/Search" +import GalleryView from "../../components/GalleryView/GalleryView" import "./Gallery.less" +import { useSearchParams } from 'react-router-dom'; +import { useState } from "react"; export default function Gallery(props) { + const [searchParams, setSearchParams] = useSearchParams(); + + const [tab, setTab] = useState( + searchParams.has('tab') ? searchParams.get('tab') : 'home' + ); + const [page, setPage] = useState( + searchParams.has('page') ? parseInt(searchParams.get('page')) : 1 + ); + const [viewing, setViewing] = useState(parseInt(searchParams.get('activity'))); + return (

Public Gallery

+
) From ddde073b500b44f412dfdeda8c9b5e1c941c9ed7 Mon Sep 17 00:00:00 2001 From: rpaigemei Date: Fri, 3 Nov 2023 17:42:21 -0400 Subject: [PATCH 08/29] content creator gallery navigation + formatting --- client/src/components/GalleryView/GalleryView.jsx | 1 + client/src/views/ContentCreator/ContentCreator.jsx | 5 +++++ client/src/views/Gallery/Gallery.jsx | 6 ++++-- client/src/views/Gallery/gallery.less | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/client/src/components/GalleryView/GalleryView.jsx b/client/src/components/GalleryView/GalleryView.jsx index b67d39f4e..4eca1ddb8 100644 --- a/client/src/components/GalleryView/GalleryView.jsx +++ b/client/src/components/GalleryView/GalleryView.jsx @@ -4,6 +4,7 @@ import { QuestionCircleOutlined } from '@ant-design/icons'; import { Link } from 'react-router-dom'; import { getAuthorizedWorkspaces, + getClassroomWorkspace, getSubmission, deleteAuthorizedWorkspace, } from '../../Utils/requests'; diff --git a/client/src/views/ContentCreator/ContentCreator.jsx b/client/src/views/ContentCreator/ContentCreator.jsx index 12ce27c5c..fd4799273 100644 --- a/client/src/views/ContentCreator/ContentCreator.jsx +++ b/client/src/views/ContentCreator/ContentCreator.jsx @@ -16,6 +16,7 @@ import LessonEditor from './LessonEditor/LessonEditor'; import { useSearchParams } from 'react-router-dom'; import './ContentCreator.less'; +import Gallery from '../Gallery/Gallery'; const { TabPane } = Tabs; @@ -204,6 +205,10 @@ export default function ContentCreator() { setSearchParams={setSearchParams} /> + + + + ); diff --git a/client/src/views/Gallery/Gallery.jsx b/client/src/views/Gallery/Gallery.jsx index 696a5d622..699a53385 100644 --- a/client/src/views/Gallery/Gallery.jsx +++ b/client/src/views/Gallery/Gallery.jsx @@ -20,8 +20,10 @@ export default function Gallery(props) { return (
-
-

Public Gallery

+ +