Skip to content

Commit 8d3bd82

Browse files
ptruong0js0mmer
andauthored
Changelog Modal (#440)
* draft * css mobile resolution * placeholder content * updated style * track last update * lint * Update site/src/component/ChangelogModal/ChangelogModal.tsx Co-authored-by: Jacob Sommer <[email protected]> * Update site/src/component/ChangelogModal/ChangelogModal.scss Co-authored-by: Jacob Sommer <[email protected]> * Update site/src/component/ChangelogModal/ChangelogModal.tsx Co-authored-by: Jacob Sommer <[email protected]> * lint * comment out * comment out * lint --------- Co-authored-by: Jacob Sommer <[email protected]>
1 parent ca829ac commit 8d3bd82

File tree

4 files changed

+86
-1
lines changed

4 files changed

+86
-1
lines changed

site/src/App.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import './style/theme.scss';
77
import './App.scss';
88

99
import AppHeader from './component/AppHeader/AppHeader';
10+
// import ChangelogModal from './component/ChangelogModal/ChangelogModal';
1011
import SearchPage from './pages/SearchPage';
1112
import CoursePage from './pages/CoursePage';
1213
import ProfessorPage from './pages/ProfessorPage';
@@ -106,6 +107,7 @@ export default function App() {
106107
<Route path="*" element={<ErrorPage />} />
107108
</Routes>
108109
</div>
110+
{/* <div className="changelog-modal">{<ChangelogModal />}</div> */}
109111
</div>
110112
</ThemeContext.Provider>
111113
</Router>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.changelog-modal {
2+
.modal-content {
3+
border: none;
4+
background-color: var(--overlay2);
5+
padding: 4px 8px 8px;
6+
}
7+
8+
.modal-header {
9+
align-items: center;
10+
border-bottom: none;
11+
padding-bottom: 0;
12+
}
13+
14+
h2 {
15+
margin-bottom: 0;
16+
font-size: 1.8rem;
17+
font-weight: 600;
18+
}
19+
20+
.modal-body {
21+
font-size: 1.2rem;
22+
margin: 0;
23+
}
24+
25+
.modal-img {
26+
margin: 1rem;
27+
max-width: 70vw;
28+
max-height: 50vh;
29+
object-fit: contain;
30+
}
31+
32+
button.close {
33+
font-size: 32px;
34+
}
35+
36+
@media only screen and (max-width: 800px) {
37+
.modal-img {
38+
max-width: 90vw;
39+
max-height: 50vh;
40+
}
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { useEffect, useState } from 'react';
2+
import './ChangelogModal.scss';
3+
import Modal from 'react-bootstrap/Modal';
4+
5+
const DESCRIPTION = 'You can now view recently added features to the PeterPortal website, listed in this modal.';
6+
const IMAGE_URL =
7+
'https://media.tenor.com/ufm_0t3ACEAAAAAM/ginger-cat-ginger-cat-eating-then-staring-at-the-camera.gif';
8+
const LAST_UPDATED = '02/27/2024';
9+
10+
const ChangelogModal = () => {
11+
const [showModal, setShowModal] = useState(false);
12+
13+
useEffect(() => {
14+
// display the changelog modal if it is the user's first time seeing it (tracked in local storage)
15+
const lastSeen = localStorage.getItem('changelogSeen');
16+
17+
if (lastSeen !== LAST_UPDATED) {
18+
setShowModal(true);
19+
20+
// mark as seen so it is not displayed after seeing it once
21+
localStorage.setItem('changelogSeen', LAST_UPDATED);
22+
}
23+
}, []);
24+
25+
const closeModal = () => {
26+
setShowModal(false);
27+
};
28+
29+
return (
30+
<Modal className="changelog-modal" show={showModal} centered onHide={closeModal}>
31+
<Modal.Header closeButton>
32+
<h2>What's New - {new Date(LAST_UPDATED).toLocaleString('default', { month: 'long', year: 'numeric' })}</h2>
33+
</Modal.Header>
34+
35+
<p className="modal-body">{DESCRIPTION}</p>
36+
<img className="modal-img" src={IMAGE_URL} alt="Screenshot or gif of new changes" />
37+
</Modal>
38+
);
39+
};
40+
41+
export default ChangelogModal;

site/src/pages/RoadmapPage/AddCoursePopup.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const AddCoursePopup: FC<AddCoursePopupProps> = () => {
121121
);
122122
})}
123123
</Form.Control>
124-
<Form.Control.Feedback type="invalid">Missing qurter</Form.Control.Feedback>
124+
<Form.Control.Feedback type="invalid">Missing quarter</Form.Control.Feedback>
125125
</Form.Group>
126126
)}
127127
<div className="d-flex justify-content-end">

0 commit comments

Comments
 (0)