Skip to content

Commit 8108516

Browse files
authored
Merge branch 'Development' into update-github-templates
2 parents 7ccb275 + 486fd5a commit 8108516

File tree

8 files changed

+160
-6
lines changed

8 files changed

+160
-6
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "CommunitySolidServer"]
2+
path = CommunitySolidServer
3+
url = https://github.com/CommunitySolidServer/CommunitySolidServer.git

CommunitySolidServer

Submodule CommunitySolidServer added at 4f09524

Dockerfile.react

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Stage 1: Build the React app
2+
FROM node:16 AS build
3+
4+
WORKDIR /app
5+
6+
COPY package*.json ./
7+
RUN npm install
8+
9+
COPY . .
10+
RUN npm run build
11+
12+
# Stage 2: Create a lightweight image to run the app
13+
FROM nginx:alpine
14+
15+
COPY --from=build /app/dist /usr/share/nginx/html
16+
17+
EXPOSE 80
18+
19+
CMD ["nginx", "-g", "daemon off;"]

config/solid-server/solid-config.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^6.0.0/components/context.jsonld",
3+
"import": [
4+
"css:CommunitySolidServer/config/app/init/default.json",
5+
"css:CommunitySolidServer/config/app/main/default.json",
6+
"css:CommunitySolidServer/config/app/setup/disabled.json",
7+
"css:CommunitySolidServer/config/app/variables/default.json",
8+
"css:CommunitySolidServer/config/http/handler/default.json",
9+
"css:CommunitySolidServer/config/http/middleware/default.json",
10+
"css:CommunitySolidServer/config/http/notifications/websockets.json",
11+
"css:CommunitySolidServer/config/http/server-factory/https.json",
12+
"css:CommunitySolidServer/config/http/static/default.json",
13+
"css:CommunitySolidServer/config/identity/access/public.json",
14+
"css:CommunitySolidServer/config/identity/email/default.json",
15+
"css:CommunitySolidServer/config/identity/handler/default.json",
16+
"css:CommunitySolidServer/config/identity/ownership/unsafe-no-check.json",
17+
"css:CommunitySolidServer/config/identity/pod/static.json",
18+
"css:CommunitySolidServer/config/identity/registration/enabled.json",
19+
"css:CommunitySolidServer/config/ldp/authentication/dpop-bearer.json",
20+
"css:CommunitySolidServer/config/ldp/authorization/allow-all.json",
21+
"css:CommunitySolidServer/config/ldp/handler/default.json",
22+
"css:CommunitySolidServer/config/ldp/metadata-parser/default.json",
23+
"css:CommunitySolidServer/config/ldp/metadata-writer/default.json",
24+
"css:CommunitySolidServer/config/ldp/modes/default.json",
25+
"css:CommunitySolidServer/config/storage/backend/file.json",
26+
"css:CommunitySolidServer/config/storage/key-value/resource-store.json",
27+
"css:CommunitySolidServer/config/storage/middleware/default.json",
28+
"css:CommunitySolidServer/config/util/auxiliary/empty.json",
29+
"css:CommunitySolidServer/config/util/identifiers/suffix.json",
30+
"css:CommunitySolidServer/config/util/index/default.json",
31+
"css:CommunitySolidServer/config/util/logging/winston.json",
32+
"css:CommunitySolidServer/config/util/representation-conversion/default.json",
33+
"css:CommunitySolidServer/config/util/resource-locker/file.json",
34+
"css:CommunitySolidServer/config/util/variables/default.json"
35+
],
36+
"@graph": [],
37+
"servers": [
38+
{
39+
"serverUri": "https://css.opencommons.net/",
40+
"locations": [
41+
{
42+
"url": "https://css.opencommons.net/",
43+
"availableMediaTypes": ["text/turtle"],
44+
"basePath": "/",
45+
"description": "This config was generated by generator and very basic"
46+
}
47+
]
48+
}
49+
],
50+
"baseUrl": "https://css.opencommons.net/"
51+
}

docker-compose.yaml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
version: '3.8'
2+
3+
services:
4+
react-app:
5+
build:
6+
context: ./
7+
dockerfile: Dockerfile.react # Creates new image for react app
8+
expose:
9+
- "8080" # Expose port for other services
10+
ports:
11+
- "8080:80"
12+
networks:
13+
- nginx_default
14+
15+
solid-server:
16+
image: solidproject/community-server:latest # Use updated image or create using Dockerfile
17+
environment:
18+
- CSS_BASE_URL=https://css.opencommons.net
19+
restart: always
20+
user: root
21+
expose:
22+
- "3000"
23+
ports:
24+
- "3000:3000"
25+
volumes:
26+
- ./data/solid-data:/data
27+
- ./config/solid-server/solid-config.json:/community-server/config/my-config.json
28+
networks:
29+
- nginx_default
30+
31+
nginx-proxy-mgr:
32+
image: 'jc21/nginx-proxy-manager:latest'
33+
restart: unless-stopped
34+
ports:
35+
# These ports are in format <host-port>:<container-port>
36+
- '80:80' # Public HTTP Port
37+
- '443:443' # Public HTTPS Port
38+
- '81:81' # Admin Web Port
39+
# Add any other Stream port you want to expose
40+
# - '21:21' # FTP
41+
environment:
42+
# Mysql/Maria connection parameters:
43+
DB_MYSQL_HOST: "db"
44+
DB_MYSQL_PORT: 3306
45+
DB_MYSQL_USER: "npm"
46+
DB_MYSQL_PASSWORD: "npm"
47+
DB_MYSQL_NAME: "npm"
48+
# Uncomment this if IPv6 is not enabled on your host
49+
# DISABLE_IPV6: 'true'
50+
volumes:
51+
- ./data/nginx-proxy-mng-data:/data
52+
- ./letsencrypt:/etc/letsencrypt
53+
depends_on:
54+
- db
55+
56+
db:
57+
image: 'jc21/mariadb-aria:latest'
58+
restart: unless-stopped
59+
environment:
60+
MYSQL_ROOT_PASSWORD: 'npm'
61+
MYSQL_DATABASE: 'npm'
62+
MYSQL_USER: 'npm'
63+
MYSQL_PASSWORD: 'npm'
64+
volumes:
65+
- ./mysql:/var/lib/mysql
66+
67+
networks:
68+
nginx_default:
69+

src/components/NavBar/NavMenu.jsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Link } from 'react-router-dom';
44
// Material UI Imports
55
import Avatar from '@mui/material/Avatar';
66
import Button from '@mui/material/Button';
7+
import Badge from '@mui/material/Badge';
78
import Divider from '@mui/material/Divider';
89
import EmailIcon from '@mui/icons-material/Email';
910
import LogoutIcon from '@mui/icons-material/Logout';
@@ -14,7 +15,7 @@ import NotificationsIcon from '@mui/icons-material/Notifications';
1415
import SettingsIcon from '@mui/icons-material/Settings';
1516
import { useTheme } from '@mui/material/styles';
1617
// Context Imports
17-
import { DocumentListContext } from '@contexts';
18+
import { DocumentListContext, MessageContext } from '@contexts';
1819

1920
/**
2021
* NavMenu Component - Component that generates NavMenu section for PASS
@@ -35,6 +36,7 @@ const NavMenu = ({
3536
}) => {
3637
const theme = useTheme();
3738
const { setContact } = useContext(DocumentListContext);
39+
const { numUnreadMessages } = useContext(MessageContext);
3840

3941
const handleMenuClose = () => {
4042
setOpenMenu(false);
@@ -64,7 +66,11 @@ const NavMenu = ({
6466
<Link to="/messages" style={{ textDecoration: 'none', color: theme.palette.primary.main }}>
6567
<MenuItem
6668
component={Button}
67-
startIcon={<EmailIcon />}
69+
startIcon={
70+
<Badge variant={numUnreadMessages > 0 ? 'dot' : 'standard'} color="error">
71+
<EmailIcon />
72+
</Badge>
73+
}
6874
sx={{ display: { md: 'none' }, color: theme.palette.primary.main, width: '100%' }}
6975
>
7076
Messages

src/components/NavBar/NavbarDesktop.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { useTheme } from '@mui/material/styles';
1717
// Component Imports
1818
import NavbarLinks from './NavbarLinks';
1919
import NavMenu from './NavMenu';
20-
import { SignedInUserContext } from '../../contexts';
20+
import { MessageContext, SignedInUserContext } from '@contexts';
2121

2222
/**
2323
* NavbarDesktop Component - Component that generates Navbar section for PASS
@@ -29,6 +29,7 @@ import { SignedInUserContext } from '../../contexts';
2929

3030
const NavbarDesktop = ({ setShowConfirmation }) => {
3131
const theme = useTheme();
32+
const { numUnreadMessages } = useContext(MessageContext);
3233

3334
// states for NavMenu component
3435
const [anchorEl, setAnchorEl] = useState(null);
@@ -81,7 +82,7 @@ const NavbarDesktop = ({ setShowConfirmation }) => {
8182
to="/messages"
8283
sx={{ marginRight: '10px' }}
8384
>
84-
<Badge color="error">
85+
<Badge badgeContent={numUnreadMessages} color="error">
8586
<EmailIcon />
8687
</Badge>
8788
</IconButton>

src/contexts/MessageContext.jsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const MessageContextProvider = ({ children }) => {
3333
const [loadMessages, setLoadMessages] = useState(true);
3434
const { session } = useContext(SessionContext);
3535
const [inboxList, setInboxList] = useState([]);
36+
const [numUnreadMessages, setNumUnreadMessages] = useState(0);
3637

3738
const [outboxList, setOutboxList] = useState([]);
3839
const messageObject = useMemo(
@@ -42,9 +43,11 @@ export const MessageContextProvider = ({ children }) => {
4243
outboxList,
4344
setOutboxList,
4445
loadMessages,
45-
setLoadMessages
46+
setLoadMessages,
47+
numUnreadMessages,
48+
setNumUnreadMessages
4649
}),
47-
[outboxList, inboxList, loadMessages]
50+
[outboxList, inboxList, loadMessages, numUnreadMessages]
4851
);
4952

5053
/**
@@ -63,6 +66,7 @@ export const MessageContextProvider = ({ children }) => {
6366
try {
6467
const messagesInboxSolid = await getMessageTTL(session, 'Inbox', inboxList, podUrl);
6568
messagesInboxSolid.sort((a, b) => b.uploadDate - a.uploadDate);
69+
setNumUnreadMessages(messagesInboxSolid.reduce((a, m) => (!m.readStatus ? a + 1 : a), 0));
6670
setInboxList(messagesInboxSolid);
6771

6872
const messagesOutboxSolid = await getMessageTTL(session, 'Outbox', outboxList, podUrl);

0 commit comments

Comments
 (0)