Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

Add support for Apple M1 as development platform. #431

Merged
merged 8 commits into from
Jul 24, 2021
Merged
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
4 changes: 2 additions & 2 deletions CollAction/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
ARG BUILD_CONFIG=Release
ARG DOTNET_CLI_TELEMETRY_OPTOUT=1
WORKDIR /src
Expand All @@ -10,7 +10,7 @@ RUN dotnet build CollAction.csproj -c $BUILD_CONFIG -o /app/build
RUN dotnet publish CollAction.csproj -c $BUILD_CONFIG -o /app/publish
RUN if [ "$BUILD_CONFIG" = "Debug" ] ; then dotnet dev-certs https -ep /app/publish/collaction.pfx -p test ; else echo skipping ssl ; fi

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim
FROM mcr.microsoft.com/dotnet/aspnet:3.1
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "CollAction.dll"]
10 changes: 5 additions & 5 deletions Frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:focal AS build
FROM node:buster AS build
ARG REACT_APP_BACKEND_URL
ARG SITEMAP_LOCATION
ARG BUILD_CONFIG
Expand All @@ -16,13 +16,13 @@ COPY nginx.conf.template .
RUN envsubst '$REACT_APP_BACKEND_URL,$SITEMAP_LOCATION' < ./nginx.conf.template > ./nginx.conf

# Install yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y yarn
#RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
#RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
#RUN apt-get update && apt-get install -y yarn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't comment out code. If it's no longer needed, delete it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it. Sorry about that, I forgot to remove those lines while I was trying to get everything working.


# Build
COPY . .
RUN yarn install
RUN yarn
RUN yarn run build

FROM nginx
Expand Down
52 changes: 26 additions & 26 deletions Frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "collaction-frontend",
"private": true,
"dependencies": {
"@apollo/client": "^3.0.0-beta.50",
"@fortawesome/fontawesome-svg-core": "^1.2",
"@apollo/client": "^3.3.21",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-brands-svg-icons": "^5.12",
"@fortawesome/free-regular-svg-icons": "^5.12",
"@fortawesome/free-solid-svg-icons": "^5.12",
Expand All @@ -16,48 +16,48 @@
"draft-js": "0.11",
"draft-js-export-html": "^1.4",
"formik": "^2.1",
"formik-material-ui": "^2.0.0-beta.1",
"graphql": "^15.0",
"formik-material-ui": "^3.0.1",
"graphql": "^15.5.1",
"gray-matter": "^4.0",
"i18next": "^19.3",
"immutable": "^3.8",
"i18next": "^20.3.4",
"immutable": "^4.0.0-rc.14",
"moment": "^2.26.0",
"mui-rte": "1.14",
"node-sass": "^4.13",
"mui-rte": "^1.29.0",
"node-sass": "^6.0.1",
"normalize.css": "^8.0",
"react": "^16.13",
"react-dom": "^16.13",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-dropzone": "^11.0",
"react-facebook-pixel": "^0.1",
"react-ga": "^2.7",
"react-facebook-pixel": "^1.0.4",
"react-ga": "^3.3.0",
"react-helmet": "^6.0",
"react-i18next": "^11.3",
"react-lazy-load-image-component": "^1.4",
"react-router-dom": "^5.1",
"react-router-hash-link": "1.2",
"react-router-hash-link": "^2.4.3",
"react-share": "^4.2.1",
"react-slick": "^0.26",
"react-slick": "^0.28.1",
"slick-carousel": "^1.8",
"yup": "^0.28"
"yup": "^0.32.9"
},
"devDependencies": {
"@testing-library/dom": "^7.2",
"@testing-library/dom": "^8.1.0",
"@testing-library/jest-dom": "^5.1",
"@testing-library/react": "^10.0",
"@testing-library/user-event": "^10.0",
"@types/jest": "^25.1",
"@types/node": "^13.9",
"@types/react": "^16.9",
"@types/react-dom": "^16.9",
"@types/react-helmet": "^5.0",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.0",
"@types/jest": "^26.0.24",
"@types/node": "^16.4.1",
"@types/react": "^17.0.14",
"@types/react-dom": "^17.0.9",
"@types/react-helmet": "^6.1.2",
"@types/react-lazy-load-image-component": "^1.3",
"@types/react-router-dom": "^5.1",
"@types/react-router-hash-link": "1.2",
"@types/react-router-hash-link": "^2.4.1",
"@types/react-slick": "^0.23",
"@types/yup": "^0.29",
"react-scripts": "3.4",
"react-scripts": "^4.0.3",
"source-map-explorer": "^2.4",
"typescript": "^3.8"
"typescript": "^4.3.5"
},
"scripts": {
"start": "react-scripts start",
Expand Down
6 changes: 4 additions & 2 deletions Frontend/src/components/Admin/AdminSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const useStyles = makeStyles(theme => ({
}
}))

export default ({ children }: any) => {
const AdminSidebar = ({ children }: any) => {
const classes = useStyles();
const history = useHistory();
return <div className={classes.root}>
Expand All @@ -53,4 +53,6 @@ export default ({ children }: any) => {
{ children }
</main>
</div>;
};
};

export default AdminSidebar;
42 changes: 26 additions & 16 deletions Frontend/src/components/Admin/Comments/AdminListComments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Formatter from "../../../formatter";
import { Button } from "../../Button/Button";
import { useSettings } from "../../../providers/SettingsProvider";

export default () => {
const AdminListComments = () => {
const { crowdactionCommentStatusses } = useSettings();
const [status, setStatus] = useState("NONE");
const [page, setPage] = useState(0);
Expand All @@ -18,7 +18,7 @@ export default () => {
const [toMutate, setToMutate] = useState<ICrowdactionComment | null>(null);
const [info, setInfo] = useState<string | null>(null);
const [error, setError] = useState<string | null>(null);
const {data, loading, error: loadingError} = useQuery(
const { data, loading, error: loadingError } = useQuery(
GET_COMMENTS,
{
fetchPolicy: "cache-and-network", // To ensure it updates after deleting/editting
Expand All @@ -30,7 +30,7 @@ export default () => {
}
}
);
const [ approveComment ] = useMutation(
const [approveComment] = useMutation(
APPROVE_COMMENT,
{
variables: {
Expand All @@ -49,7 +49,7 @@ export default () => {
}
}
);
const [ deleteComment ] = useMutation(
const [deleteComment] = useMutation(
DELETE_COMMENT,
{
variables: {
Expand Down Expand Up @@ -80,7 +80,7 @@ export default () => {
const commentCount = data?.crowdactionCommentCount ?? 0;

return <>
{ loading ? <Loader /> : null }
{loading ? <Loader /> : null}
<Alert type="info" text={info} />
<Alert type="error" text={error} />
<Alert type="error" text={loadingError?.message} />
Expand All @@ -107,7 +107,7 @@ export default () => {
<InputLabel shrink id="status">Status</InputLabel>
<Select name="status" labelId="status" value={status} onChange={(ev) => setStatus(ev.target.value as string)}>
<MenuItem key="" value="NONE">NONE</MenuItem>
{ crowdactionCommentStatusses.map(c => <MenuItem key={c} value={c}>{c}</MenuItem>) }
{crowdactionCommentStatusses.map(c => <MenuItem key={c} value={c}>{c}</MenuItem>)}
</Select>
<TableContainer component={Paper}>
<Table aria-label="simple table">
Expand All @@ -123,19 +123,27 @@ export default () => {
</TableRow>
</TableHead>
<TableBody>
{ data?.crowdactionComments.map((u: ICrowdactionComment) => (
{data?.crowdactionComments.map((u: ICrowdactionComment) => (
<TableRow key={u.id}>
<TableCell component="th" scope="row">{ u.user?.fullName ?? u.anonymousCommentUser }</TableCell>
<TableCell align="left">{ u.crowdaction?.name }</TableCell>
<TableCell align="left">{ Formatter.date(new Date(u.commentedAt)) }</TableCell>
<TableCell align="left">{ u.status }</TableCell>
<TableCell align="left">{ u.comment }</TableCell>
<TableCell align="center">{ u.status !== 'APPROVED' && <Button onClick={() => { setApproveDialogOpen(true); setToMutate(u)}}>Approve</Button> }</TableCell>
<TableCell align="center">{ u.status !== 'DELETED' && <Button onClick={() => { setDeleteDialogOpen(true); setToMutate(u); }}>Delete</Button> }</TableCell>
<TableCell component="th" scope="row">{u.user?.fullName ?? u.anonymousCommentUser}</TableCell>
<TableCell align="left">{u.crowdaction?.name}</TableCell>
<TableCell align="left">{Formatter.date(new Date(u.commentedAt))}</TableCell>
<TableCell align="left">{u.status}</TableCell>
<TableCell align="left">{u.comment}</TableCell>
<TableCell align="center">{u.status !== 'APPROVED' && <Button onClick={() => { setApproveDialogOpen(true); setToMutate(u) }}>Approve</Button>}</TableCell>
<TableCell align="center">{u.status !== 'DELETED' && <Button onClick={() => { setDeleteDialogOpen(true); setToMutate(u); }}>Delete</Button>}</TableCell>
</TableRow>))
}
<TableRow>
<TablePagination count={commentCount} page={page} rowsPerPageOptions={[5, 10, 25, 50]} rowsPerPage={rowsPerPage} onChangePage={(_ev, newPage) => setPage(newPage)} onChangeRowsPerPage={(ev) => { setPage(0); setRowsPerPage(parseInt((ev.target.value))) } } />
<TablePagination
component="div"
count={commentCount}
page={page}
rowsPerPageOptions={[5, 10, 25, 50]}
rowsPerPage={rowsPerPage}
onPageChange={(_ev, newPage) => setPage(newPage)}
onChangeRowsPerPage={(ev) => { setPage(0); setRowsPerPage(parseInt((ev.target.value))) }}
/>
</TableRow>
</TableBody>
</Table>
Expand Down Expand Up @@ -187,4 +195,6 @@ const APPROVE_COMMENT = gql`
}
}
}
`;
`;

export default AdminListComments;
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const editCrowdactionStyles = makeStyles(theme => ({
}
}));

export default ({ crowdactionId } : IEditCrowdactionProps): any => {
const AdminEditCrowdaction = ({ crowdactionId } : IEditCrowdactionProps): any => {
const classes = editCrowdactionStyles();
const history = useHistory();
const { categories, displayPriorities, crowdactionStatusses } = useSettings();
Expand Down Expand Up @@ -455,4 +455,6 @@ const GET_CROWDACTION = gql`
${Fragments.crowdactionDetail}
}
}
`;
`;

export default AdminEditCrowdaction;
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { Fragments } from "../../../api/fragments";
import Formatter from "../../../formatter";
import { Button } from "../../Button/Button";

export default () => {
const AdminListCrowdactions = () => {
const [page, setPage] = useState(0);
const [rowsPerPage, setRowsPerPage] = useState(10);
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
const [toDelete, setToDelete] = useState<ICrowdaction | null>(null);
const [info, setInfo] = useState<string | null>(null);
const [error, setError] = useState<string | null>(null);
const {data, loading, error: loadingError} = useQuery(
const { data, loading, error: loadingError } = useQuery(
GET_CROWDACTIONS,
{
fetchPolicy: "cache-and-network", // To ensure it updates after deleting/editting
Expand All @@ -26,7 +26,7 @@ export default () => {
}
}
);
const [ deleteCrowdaction ] = useMutation(
const [deleteCrowdaction] = useMutation(
DELETE_CROWDACTION,
{
variables: {
Expand All @@ -43,7 +43,7 @@ export default () => {
console.error(data.message);
},
awaitRefetchQueries: true,
refetchQueries: [{
refetchQueries: [{
query: GET_CROWDACTIONS,
variables: {
skip: rowsPerPage * page,
Expand All @@ -56,14 +56,14 @@ export default () => {
const crowdactionCount = data?.crowdactionCount ?? 0;

return <>
{ loading ? <Loader /> : null }
{loading ? <Loader /> : null}
<Alert type="info" text={info} />
<Alert type="error" text={error} />
<Alert type="error" text={loadingError?.message} />
<Dialog open={deleteDialogOpen} onClose={() => setDeleteDialogOpen(false)}>
<DialogTitle>Delete crowdaction { toDelete?.name }?</DialogTitle>
<DialogTitle>Delete crowdaction {toDelete?.name}?</DialogTitle>
<DialogContent>
Are you sure you wish to delete "{ toDelete?.name }"?
Are you sure you wish to delete "{toDelete?.name}"?
</DialogContent>
<DialogActions>
<Button onClick={() => deleteCrowdaction()}>Yes</Button>
Expand All @@ -84,19 +84,27 @@ export default () => {
</TableRow>
</TableHead>
<TableBody>
{ data?.crowdactions.map((p: ICrowdaction) => (
{data?.crowdactions.map((p: ICrowdaction) => (
<TableRow key={p.id}>
<TableCell component="th" scope="row">{ p.name }</TableCell>
<TableCell align="right">{ p.status }</TableCell>
<TableCell align="right">{ Formatter.date(new Date(p.start)) }</TableCell>
<TableCell align="right">{ Formatter.date(new Date(p.end)) } { Formatter.time(new Date(p.end)) }</TableCell>
<TableCell align="right">{ p.isActive ? "Yes" : "No" }</TableCell>
<TableCell component="th" scope="row">{p.name}</TableCell>
<TableCell align="right">{p.status}</TableCell>
<TableCell align="right">{Formatter.date(new Date(p.start))}</TableCell>
<TableCell align="right">{Formatter.date(new Date(p.end))} {Formatter.time(new Date(p.end))}</TableCell>
<TableCell align="right">{p.isActive ? "Yes" : "No"}</TableCell>
<TableCell align="right"><Button to={`/admin/crowdactions/edit/${p.id}`}>Edit</Button></TableCell>
<TableCell align="right"><Button onClick={() => { setDeleteDialogOpen(true); setToDelete(p); }}>Delete</Button></TableCell>
</TableRow>))
}
<TableRow>
<TablePagination count={crowdactionCount} page={page} rowsPerPageOptions={[5, 10, 25, 50]} rowsPerPage={rowsPerPage} onChangePage={(_ev, newPage) => setPage(newPage)} onChangeRowsPerPage={(ev) => { setPage(0); setRowsPerPage(parseInt((ev.target.value))) }} />
<TablePagination
component="div"
count={crowdactionCount}
page={page}
rowsPerPageOptions={[5, 10, 25, 50]}
rowsPerPage={rowsPerPage} onChangePage={(_ev, newPage) => setPage(newPage)}
onPageChange={(_ev, newPage) => setPage(newPage)}
onChangeRowsPerPage={(ev) => { setPage(0); setRowsPerPage(parseInt((ev.target.value))) }}
/>
</TableRow>
</TableBody>
</Table>
Expand All @@ -119,4 +127,6 @@ const DELETE_CROWDACTION = gql`
deleteCrowdaction(id: $id)
}
}
`;
`;

export default AdminListCrowdactions;
6 changes: 4 additions & 2 deletions Frontend/src/components/Admin/Users/AdminEditUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const editUserStyles = makeStyles(theme => ({
}
}));

export default ({ userId } : IEditUserProps): any => {
const AdminEditUser = ({ userId } : IEditUserProps): any => {
const classes = editUserStyles();
const history = useHistory();
const [ error, setError ] = useState<string | null>(null);
Expand Down Expand Up @@ -182,4 +182,6 @@ const GET_USER = gql`
representsNumberParticipants
}
}
`;
`;

export default AdminEditUser;
Loading