Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kl628/Notification Modal Announce #477

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This pull request is the first step towards implementing feature Foo

<!--- List any important or subtle points, future considerations, or other items of note. -->

### Breaking Changes <!-- Optional -->
### Breaking Changes <!-- Optional -->

<!-- Uncomment items that apply: -->

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-backend-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: CI Test
on:
on:
pull_request:
paths: ['server/**']

Expand Down
46 changes: 25 additions & 21 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<script src="https://accounts.google.com/gsi/client" async defer></script>
<!--
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<script src="https://accounts.google.com/gsi/client" async defer></script>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Expand All @@ -21,12 +26,11 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Carriage</title>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
<title>Carriage</title>
</head>

</html>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
11 changes: 10 additions & 1 deletion frontend/src/components/Notification/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const Notification = () => {
const [messages, setMessages] = useState<Message[]>([]);
const [notify, setNotify] = useState(false);
const popupId = useId();
const [isNotifOpen, setIsNotifOpen] = useState(false);

useEffect(() => {
navigator.serviceWorker.addEventListener('message', (event) => {
Expand Down Expand Up @@ -72,7 +73,11 @@ const Notification = () => {
return (
<Popup
trigger={
<button id={popupId} className={styles.bell}>
<button
id={popupId}
aria-expanded={isNotifOpen}
className={styles.bell}
>
<img src={notificationBell} alt="Notifications" />
{notify && (
<img
Expand All @@ -83,10 +88,14 @@ const Notification = () => {
)}
</button>
}
onOpen={() => {
setIsNotifOpen(true);
Atikpui007 marked this conversation as resolved.
Show resolved Hide resolved
}}
onClose={() => {
setMessages([...newMessages, ...messages]);
setNewMessages([]);
setNotify(false);
setIsNotifOpen(false);
}}
position={['bottom right']}
contentStyle={{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
"url": "https://github.com/cornell-dti/carriage-web/issues"
},
"homepage": "https://github.com/cornell-dti/carriage-web#readme"
}
}
Loading