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

Feature/document links #221

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
599a435
CI/CD config files
ossitammi Feb 2, 2024
7897a19
Remove unused steps
ossitammi Feb 2, 2024
fda67e1
Renamed jobs and file paths
ossitammi Feb 2, 2024
4276560
Updated node version
ossitammi Feb 2, 2024
8885736
Added info page for personal info querying
Feb 9, 2024
ee0597a
Added personal info to csv export
Feb 10, 2024
1e8af6b
Added personal info for pdf report
Feb 10, 2024
7c07301
Added missing translations
Feb 10, 2024
1a34971
Enable language support for the info page
Feb 10, 2024
cff2cb9
Access info page values through lang parameter
Feb 12, 2024
58dddf4
Removed console loggings
Feb 12, 2024
16b9427
Spread personal info to pdf
Feb 13, 2024
dc1b5cd
Removed extra comma
Feb 13, 2024
2a7518c
Merge pull request #1 from Oulunkaupunki/feature/info-form
ossitammi Feb 13, 2024
3c87858
Added Oulu specific info texts and links
Feb 13, 2024
106effa
Merge pull request #2 from Oulunkaupunki/feature/oulu-texts
ossitammi Feb 13, 2024
56af90a
Merge pull request #3 from Oulunkaupunki/tre-develop
ossitammi Feb 15, 2024
3c84b57
Support other projections besides 3067
Feb 16, 2024
1b2f94e
Merge pull request #4 from Oulunkaupunki/feature/projection-support
ossitammi Feb 16, 2024
aba4f28
Store geometries in given coordinate system
Mar 11, 2024
0dab369
Added srid information to geopackage export
Mar 11, 2024
6167257
Removed console logs
Mar 11, 2024
f483d94
Merge pull request #5 from Oulunkaupunki/feature/multi-projection
ossitammi Mar 11, 2024
f0b4a51
Added ouka brand colors
Mar 11, 2024
a74f02c
Merge pull request #6 from Oulunkaupunki/feature/ouka-colors
ossitammi Mar 11, 2024
800d6c2
Added privacy statement
Mar 26, 2024
4639fa8
Added a11y link and bounding box for links
Apr 10, 2024
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
97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: CI

on:
# Open any PR -> run tests
pull_request:
types: [opened, synchronize, reopened]
# Push to main branch -> run tests, build & deploy to test
push:
branches: [master]

env:
NODE_VERSION: 20
IMAGE_NAME: ${{ secrets.REGISTRY_ADDRESS }}/vuorovaikutusalusta

jobs:
test-client:
name: Test client
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
cache-dependency-path: ./client/package-lock.json
- name: Build & test
working-directory: client
run: npm i && npm test && npm run build

test-server:
name: Test server
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
cache-dependency-path: ./server/package-lock.json
- name: Build & test
working-directory: server
run: npm i && npm test && npm run build

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_ADDRESS }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
# Push only with 'latest' tag for caching
- name: Build
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.IMAGE_NAME }}:latest
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
cache-to: type=inline

push:
name: Push
# Run push only on pushes to master
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
needs: [test-client, test-server, build]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_ADDRESS }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
# Rebuild the image using the "latest" tag as cache
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.IMAGE_NAME }}:latest
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
cache-to: type=inline

deploy:
name: Deploy
needs: push
runs-on: ubuntu-latest
steps:
- name: Deploy
run: curl --fail -X POST '${{ secrets.DEPLOY_WEBHOOK_URL }}'
35 changes: 0 additions & 35 deletions .github/workflows/pr-test.yml

This file was deleted.

3 changes: 1 addition & 2 deletions client/src/components/Compose.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { ComponentType } from 'react';
import { ReactNode } from 'react';
import React, { ComponentType, ReactNode } from 'react';

type Components = ComponentType | [ComponentType, { [key: string]: any }];

Expand Down
198 changes: 198 additions & 0 deletions client/src/components/SurveyInfoPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
import { LocalizedText, PersonalInfo } from '@interfaces/survey';
import { Button, Grid, TextField, Theme, Typography } from '@mui/material';
import { makeStyles } from '@mui/styles';
import { useSurveyAnswers } from '@src/stores/SurveyAnswerContext';
import { useTranslations } from '@src/stores/TranslationContext';
import { getClassList } from '@src/utils/classes';
import React, { useState } from 'react';

const useStyles = makeStyles((theme: Theme & { [customKey: string]: any }) => ({
root: {
display: 'flex',
width: '60%',
minHeight: '-webkit-fill-available',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
margin: 0,
[theme.breakpoints.down(600)]: {
fontSize: '9vw',
width: '100%',
},
},
queryContainer: {
display: 'flex',
flexDirection: 'column',
},
infoPageContainer: {
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
},
textField: {
marginBottom: '1rem',
},
title: {
fontFamily: '"Montserrat", sans-serif',
fontSize: '3rem',
[theme.breakpoints.down(600)]: {
fontSize: '9vw',
},
},
subtitle: {
fontFamily: '"Montserrat", sans-serif',
fontSize: '1rem',
textTransform: 'none',
paddingBottom: '1rem',
[theme.breakpoints.down(600)]: {
fontSize: '4vw',
paddingLeft: '1rem',
},
},
heading: {
textTransform: 'uppercase',
fontSize: '2rem',
wordBreak: 'break-word',
hyphens: 'auto',
textAlign: 'center',
fontWeight: 800,
lineHeight: 1.5,
margin: '1rem',
'& span': {
backgroundColor: theme.palette.primary.main,
color: theme.palette.primary.contrastText,
padding: '1rem',
boxDecorationBreak: 'clone',
[theme.breakpoints.down(600)]: {
padding: '1vw',
},
},
},
}));

interface Props {
infoPageContent: { title: LocalizedText; text: LocalizedText };
personalInfoQuery?: {
name?: boolean;
email?: boolean;
phoneNumber?: boolean;
};
onStart: () => void;
}

export default function SurveyInfoPage({
onStart,
infoPageContent,
personalInfoQuery,
}: Props) {
const { tr, surveyLanguage } = useTranslations();
const classes = useStyles();
const { setPersonalInfo } = useSurveyAnswers();
const [personalInfoValues, setPersonalInfoValues] =
useState<PersonalInfo>(null);

return (
<form
onSubmit={(event) => {
event.preventDefault();
setPersonalInfo(personalInfoValues);
onStart();
}}
style={{
width: '100%',
height: '100%',
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
}}
>
<Grid container spacing={4} className={classes.root}>
<Grid item xs={12} style={{ padding: 0 }}>
{infoPageContent?.title?.[surveyLanguage] && (
<Typography
className={getClassList([classes.heading, classes.title])}
variant="h3"
>
{infoPageContent.title[surveyLanguage]}
</Typography>
)}
{infoPageContent?.text?.[surveyLanguage] && (
<Typography
className={getClassList([classes.subtitle])}
variant="body1"
>
{infoPageContent?.text[surveyLanguage]}
</Typography>
)}
</Grid>
<Grid
item
xs={12}
style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
padding: '2rem 0 0 0',
}}
>
<Typography style={{ paddingBottom: '1rem' }}>
{' '}
{tr.SurveyInfoPage.fillEntries}:{' '}
</Typography>
{personalInfoQuery.name && (
<TextField
className={classes.textField}
label={tr.SurveyInfoPage.name}
value={personalInfoValues?.name ?? ''}
onChange={(event) => {
setPersonalInfoValues({
...personalInfoValues,
name: event.target.value,
});
}}
/>
)}
{personalInfoQuery.phoneNumber && (
<TextField
type="tel"
inputProps={{
pattern: '\\+?[0-9\\s-]+',
}}
className={classes.textField}
label={tr.SurveyInfoPage.phoneNumber}
value={personalInfoValues?.phoneNumber ?? ''}
onChange={(event) => {
setPersonalInfoValues({
...personalInfoValues,
phoneNumber: event.target.value,
});
}}
></TextField>
)}
{personalInfoQuery.email && (
<TextField
type="email"
className={classes.textField}
label={tr.SurveyInfoPage.email}
value={personalInfoValues?.email ?? ''}
onChange={(event) => {
setPersonalInfoValues({
...personalInfoValues,
email: event.target.value,
});
}}
></TextField>
)}
</Grid>
<Grid item xs={12} style={{ padding: 0 }}>
<Button type="submit" variant="contained">
{tr.SurveyInfoPage.startSurvey}
</Button>
</Grid>
</Grid>
</form>
);
}
15 changes: 5 additions & 10 deletions client/src/components/SurveyLandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {
Box,
Button,
Link,
Stack,
Theme,
Typography,
Stack,
useMediaQuery,
} from '@mui/material';
import { makeStyles } from '@mui/styles';
Expand Down Expand Up @@ -142,7 +142,7 @@ export default function SurveyLandingPage({
<img
style={{
maxWidth: '60%',
maxHeight: '100%',
maxHeight: '15vh',
}}
src={`/api/feature-styles/icons/logo`}
alt={tr.IconAltTexts.logoAltText}
Expand Down Expand Up @@ -187,22 +187,17 @@ export default function SurveyLandingPage({
whiteSpace: 'nowrap',
}}
>
<Footer>
<Footer style={{ backgroundColor: '#f2f2f2', paddingRight: '2rem'}}>
<Link
color="primary"
underline="hover"
href="https://www.tampere.fi/asioi-kaupungin-kanssa/oskari-karttakyselypalvelun-saavutettavuusseloste"
href="https://www.ouka.fi/yhteystiedot-ja-palaute/oulun-kaupungin-karttakyselypalvelun-saavutettavuusseloste"
target="_blank"
>
{tr.FooterLinks.accessibility}
</Link>
{survey.displayPrivacyStatement && (
<Link
color="primary"
underline="hover"
href="https://www.tampere.fi/tietosuoja-ja-tiedonhallinta/tietosuojaselosteet"
target="_blank"
>
<Link color="primary" underline="hover" href="https://www.ouka.fi/tietosuoja/tietosuojaselosteet" target="_blank">
{tr.FooterLinks.privacyStatement}
</Link>
)}
Expand Down
Loading
Loading