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

Release HAI.01.6 #399

Merged
merged 22 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c42d9b8
HAI-1586 Change hanke contact data model (#370)
pitkni Sep 25, 2023
0e2c672
HAI-1884 Identify user coming from invitation link (#374)
markohaarni Sep 25, 2023
50d92f1
HAI-1599 Navigate to hanke list after generated hanke deletion (#376)
pitkni Sep 26, 2023
8f7dea6
HAI-1898 Remove ykt from tyomaatyyppi enum (#377)
pitkni Sep 27, 2023
8e9a64d
HAI-1512 Implement sending invitation links again in user rights view…
markohaarni Oct 3, 2023
3496cc8
HAI-1945 Don't show edit hanke link buttons in hanke list if user doe…
markohaarni Oct 6, 2023
65ac60a
HAI-1946 Only show buttons that user has permissions for in hanke vie…
markohaarni Oct 6, 2023
a4b1371
HAI-1947 Show buttons in application view according to user permissio…
markohaarni Oct 6, 2023
2c26416
HAI-1939 Fix problem where validation errors would remain when fillin…
markohaarni Oct 9, 2023
f0848ec
HAI-1904 Add Helsinki logo to public folder (#387)
markohaarni Oct 9, 2023
86758a0
HAI-1736 Update copyright footer to adhere to OSM licence (#386)
pitkni Oct 9, 2023
b890072
HAI-1944 Add instructions for translation scripts to README (#388)
corvidian Oct 10, 2023
bedc0f9
HAI-1866 Add length limit for hanke name (#389)
pitkni Oct 10, 2023
0e70262
HAI-1814 Fix sending multiple application delete requests (#383)
markohaarni Oct 10, 2023
dcfcf00
HAI-1879 Show separate bus and tram indexes (#384)
markohaarni Oct 12, 2023
9d629f9
HAI-1779 Update README (#392)
pitkni Oct 13, 2023
cecb258
HAI-1921 Fix incorrect focus order of fields with error in cable repo…
markohaarni Oct 13, 2023
3c7d70c
HAI-1248 Fix document scroll position in forms (#390)
markohaarni Oct 16, 2023
f1c0d6a
HAI-1463 Change frontend to use hanke status returned from backend (#…
markohaarni Oct 18, 2023
4c66865
HAI-1881 Save hanke form in summary page (#393)
markohaarni Oct 18, 2023
e21d012
HAI-1944 Update translations (#395)
corvidian Oct 20, 2023
5bcd4b2
HAI-2057 Delete Suunnitteluvaihe from Hanke (#396)
umeetiusbaar Oct 24, 2023
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 .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
'object-curly-spacing': ['warn', 'always'],
'react/jsx-props-no-spreading': 'off',
'import/prefer-default-export': 'off',
'react-hooks/exhaustive-deps': 'off',
'react-hooks/exhaustive-deps': 'warn',
'no-underscore-dangle': ['error', { allow: ['__typename', '_env_'] }],
'no-param-reassign': [
'error',
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ package-lock.json
public/env-config.js
public/test-env-config.js

# Generated Excel-sheet with translations and it's cache file
locale_export.xlsx
~$locale_export.xlsx

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Haitaton UI

Haitaton is a service owned by the city of Helsinki that supports the management and prediction of the adverse
effects of projects taking place within the urban area.

## Requirements

- Node 16.x
Expand Down Expand Up @@ -29,7 +32,7 @@ with `scripts/update-runtime-env.ts`, which contains the actual used variables w
App is not using create-react-app's default `process.env` way to refer of variables
but `window._env_` object.

### 'yarn e2e'
### `yarn e2e`

Runs E2E cypress tests

Expand Down Expand Up @@ -82,7 +85,20 @@ the identification method in the local environment, edit the `.env` -file.

Then either rebuild the docker container or run `yarn update-runtime-env` as discussed above.

All cloud instances use Helsinki AD identification for now.
In the cloud instances, dev uses Helsinki AD identification while others use Suomi.fi.

## Excel for translations

You can export an Excel-file with current translations. This can then be sent to translators.

1. In the repository root, run the export script with `yarn locales:export`.
2. The translations are written to `locale_export.xlsx`.

After the translations are added to the Excel file, they can be imported back.

1. Place the translated file inside repository root. It needs to be named `locale_export.xlsx`.
2. Run the import script: `yarn locales:import`.
3. The translations in `/src/locales` are updated.

## API mocking

Expand Down
7 changes: 3 additions & 4 deletions cypress/integration/E2E.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
HankeDataDraft,
HankeIndexData,
HANKE_INDEX_TYPE,
HANKE_SUUNNITTELUVAIHE,
} from '../../src/domain/types/hanke';
import { createHankeFromUI } from '../utils/formFiller';
import { validateIndexes } from '../utils/indexValidator';
Expand Down Expand Up @@ -68,15 +67,14 @@ const hankeMock: HankeDataDraft = {
],
tyomaaKatuosoite: 'Mannerheimintie 14',
vaihe: HANKE_VAIHE.SUUNNITTELU,
suunnitteluVaihe: HANKE_SUUNNITTELUVAIHE.KATUSUUNNITTELU_TAI_ALUEVARAUS,
omistajat: [
{
id: null, // not used but types require it
nimi: 'Harri Hankettaja',
email: '[email protected]',
puhelinnumero: '12341234',
tyyppi: 'YKSITYISHENKILO',
ytunnusTaiHetu: 'tunnus',
ytunnus: 'tunnus',
},
],
};
Expand All @@ -87,7 +85,8 @@ const hankeMockIndex: Partial<HankeIndexData> = {
tyyppi: HANKE_INDEX_TYPE.PERUSINDEKSI,
},
pyorailyIndeksi: 3,
joukkoliikenneIndeksi: 4,
raitiovaunuIndeksi: 4,
linjaautoIndeksi: 3,
perusIndeksi: 4.8,
};

Expand Down
33 changes: 2 additions & 31 deletions cypress/utils/formFiller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,17 @@ import {
HANKE_TARINAHAITTA_KEY,
HANKE_VAIHE,
HankeDataDraft,
HANKE_SUUNNITTELUVAIHE,
HANKE_VAIHE_KEY,
HANKE_SUUNNITTELUVAIHE_KEY,
} from '../../src/domain/types/hanke';

export const selectHankeVaihe = (
vaihe: HANKE_VAIHE_KEY,
suunnitteluVaihe?: HANKE_SUUNNITTELUVAIHE_KEY
) => {
export const selectHankeVaihe = (vaihe: HANKE_VAIHE_KEY) => {
cy.get('#vaihe-toggle-button').click();
switch (vaihe) {
case HANKE_VAIHE.OHJELMOINTI:
cy.get('#vaihe-item-0').click();
break;
case HANKE_VAIHE.SUUNNITTELU:
cy.get('#vaihe-item-1').click();
if (suunnitteluVaihe) {
cy.get('#suunnitteluVaihe-toggle-button').click();
switch (suunnitteluVaihe) {
case HANKE_SUUNNITTELUVAIHE.YLEIS_TAI_HANKE:
cy.get('#suunnitteluVaihe-item-0').click();
break;
case HANKE_SUUNNITTELUVAIHE.KATUSUUNNITTELU_TAI_ALUEVARAUS:
cy.get('#suunnitteluVaihe-item-1').click();
break;
case HANKE_SUUNNITTELUVAIHE.RAKENNUS_TAI_TOTEUTUS:
cy.get('#suunnitteluVaihe-item-2').click();
break;
case HANKE_SUUNNITTELUVAIHE.TYOMAAN_TAI_HANKKEEN_AIKAINEN:
cy.get('#suunnitteluVaihe-item-3').click();
break;
default:
break;
}
} else {
throw new Error('Tämä testin vaihe tarvitsee suunnitteluvaiheen');
}
break;
case HANKE_VAIHE.RAKENTAMINEN:
cy.get('#vaihe-item-2').click();
Expand All @@ -69,10 +43,7 @@ export const fillForm0 = (hankeData: HankeDataDraft) => {
}
cy.get('input[data-testid=nimi]').click();

selectHankeVaihe(
hankeData.vaihe,
hankeData.suunnitteluVaihe ? hankeData.suunnitteluVaihe : undefined
);
selectHankeVaihe(hankeData.vaihe);

if (hankeData.onYKTHanke) {
cy.get('input[data-testid=onYKTHanke]').click();
Expand Down
11 changes: 6 additions & 5 deletions cypress/utils/indexValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ export const validateIndexes = (hankeIndexData: Partial<HankeIndexData>) => {
if (hankeIndexData.liikennehaittaIndeksi && hankeIndexData.liikennehaittaIndeksi.indeksi) {
cy.get('[data-testid=test-liikennehaittaIndeksi]').should('not.be.empty');
cy.get('[data-testid=test-liikennehaittaIndeksi]').contains(
hankeIndexData.liikennehaittaIndeksi.indeksi
hankeIndexData.liikennehaittaIndeksi.indeksi,
);
}
if (hankeIndexData.pyorailyIndeksi) {
cy.get('[data-testid=test-pyorailyIndeksi]').should('not.be.empty');
cy.get('[data-testid=test-pyorailyIndeksi]').contains(hankeIndexData.pyorailyIndeksi);
}
if (hankeIndexData.joukkoliikenneIndeksi) {
cy.get('[data-testid=test-joukkoliikenneIndeksi]').contains(
hankeIndexData.joukkoliikenneIndeksi
);
if (hankeIndexData.raitiovaunuIndeksi) {
cy.get('[data-testid=test-raitiovaunuIndeksi]').contains(hankeIndexData.raitiovaunuIndeksi);
}
if (hankeIndexData.linjaautoIndeksi) {
cy.get('[data-testid=test-linjaautoIndeksi]').contains(hankeIndexData.linjaautoIndeksi);
}
if (hankeIndexData.perusIndeksi) {
cy.get('[data-testid=test-ruuhkautumisIndeksi]').contains(hankeIndexData.perusIndeksi);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build-and-serve": "yarn run build && yarn run serve",
"update-runtime-env": "ts-node -P ./scripts/tsconfig.json --files scripts/update-runtime-env.ts",
"test": "TEST=true yarn run update-runtime-env && DEBUG_PRINT_LIMIT=50000 react-scripts test",
"testCI": "CI=true react-scripts test",
"testCI": "TEST=true yarn run update-runtime-env && CI=TRUE DEBUG_PRINT_LIMIT=50000 react-scripts test",
"eject": "react-scripts eject",
"type-check": "tsc --pretty --noEmit",
"format": "prettier --write",
Expand Down Expand Up @@ -79,7 +79,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"react-hook-form": "^7.35.0",
"react-hook-form": "^7.47.0",
"react-i18next": "^12.0.0",
"react-query": "^3.39.2",
"react-redux": "^8.0.5",
Expand Down
Binary file added public/helsinki.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ self.addEventListener('fetch', function (event) {
console.warn(
'[MSW] Successfully emulated a network error for the "%s %s" request.',
request.method,
request.url
request.url,
);
return;
}
Expand All @@ -131,9 +131,9 @@ self.addEventListener('fetch', function (event) {
[MSW] Caught an exception from the "%s %s" request (%s). This is probably not a problem with Mock Service Worker. There is likely an additional logging output above.`,
request.method,
request.url,
`${error.name}: ${error.message}`
`${error.name}: ${error.message}`,
);
})
}),
);
});

Expand Down
2 changes: 2 additions & 0 deletions src/common/components/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import theme from './theme';
import { GlobalNotificationProvider } from '../globalNotification/GlobalNotificationContext';
import GlobalNotification from '../globalNotification/GlobalNotification';
import { FeatureFlagsProvider } from '../featureFlags/FeatureFlagsContext';
import ScrollToTop from '../scrollToTop/ScrollToTop';
import './app.scss';
import '../../../assets/styles/reset.css';

const queryClient = new QueryClient();

const App: React.FC<React.PropsWithChildren<unknown>> = () => (
<Router>
<ScrollToTop />
<Provider store={store}>
<QueryClientProvider client={queryClient}>
<ChakraProvider theme={theme}>
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function HaitatonFooter() {
<Footer.Item as={Link} to={ACCESSIBILITY.path} label={ACCESSIBILITY.label} />
<Footer.Item as={Link} to={PRIVACY_POLICY.path} label={PRIVACY_POLICY.label} />
</Footer.Navigation>
<Footer.Base copyrightHolder="Helsingin kaupunki" />
<Footer.Base copyrightHolder="Helsingin kaupunki, OpenStreetMap contributors" />
</Footer>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/common/components/radiobutton/BooleanRadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Props<T extends FieldValues> = {
*/
const BooleanRadioButton = <T extends FieldValues>({ name, id, label, value }: Props<T>) => {
const {
field: { onChange, onBlur, value: inputValue },
field: { onChange, onBlur, value: inputValue, ref },
} = useController({ name });

return (
Expand All @@ -30,6 +30,7 @@ const BooleanRadioButton = <T extends FieldValues>({ name, id, label, value }: P
value={value.toString()}
checked={value === inputValue}
data-testid={id}
ref={ref}
/>
);
};
Expand Down
15 changes: 15 additions & 0 deletions src/common/components/scrollToTop/ScrollToTop.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';

/**
* Scroll to top of document when URL pathname changes
*/
export default function ScrollToTop() {
const { pathname } = useLocation();

useEffect(() => {
window.scrollTo(0, 0);
}, [pathname]);

return null;
}
3 changes: 2 additions & 1 deletion src/common/components/textArea/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const TextArea: React.FC<Props> = ({
control={control}
defaultValue=""
shouldUnregister={shouldUnregister}
render={({ field: { onChange, onBlur, value }, fieldState: { error } }) => {
render={({ field: { onChange, onBlur, value, ref }, fieldState: { error } }) => {
return (
<HdsTextArea
id={name}
Expand All @@ -53,6 +53,7 @@ const TextArea: React.FC<Props> = ({
required={required}
disabled={disabled}
errorText={getInputErrorText(t, error)}
ref={ref}
/>
);
}}
Expand Down
3 changes: 3 additions & 0 deletions src/common/components/textInput/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { getInputErrorText } from '../../utils/form';
type PropTypes = {
name: string;
label?: string;
maxLength?: number | undefined;
disabled?: boolean;
required?: boolean;
readOnly?: boolean;
Expand All @@ -23,6 +24,7 @@ type PropTypes = {
const TextInput: React.FC<React.PropsWithChildren<PropTypes>> = ({
name,
label,
maxLength = undefined,
disabled,
tooltip,
required,
Expand All @@ -48,6 +50,7 @@ const TextInput: React.FC<React.PropsWithChildren<PropTypes>> = ({
className={className}
label={label || t(`hankeForm:labels:${name}`)}
value={value || ''}
maxLength={maxLength}
helperText={helperText}
placeholder={placeholder}
errorText={getInputErrorText(t, error)}
Expand Down
2 changes: 2 additions & 0 deletions src/common/routes/LocaleRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import EditJohtoselvitysPage from '../../pages/EditJohtoselvitysPage';
import NotFoundPage from '../../pages/staticPages/404Page';
import ManualPage from '../../pages/staticPages/ManualPage';
import AccessRightsPage from '../../pages/AccessRightsPage';
import UserIdentify from '../../domain/auth/components/UserIdentify';

const LocaleRoutes = () => {
const { t } = useTranslation();
Expand Down Expand Up @@ -74,6 +75,7 @@ const LocaleRoutes = () => {
<Route path={t('routes:REFERENCES:path')} element={<ReferencesPage />} />
<Route path={t('routes:PRIVACY_POLICY:path')} element={<PrivacyPolicyPage />} />
<Route path={t('routes:MANUAL:path')} element={<ManualPage />} />
<Route path={t('routes:IDENTIFY_USER:path')} element={<UserIdentify />} />
<Route path="*" element={<NotFoundPage />} />
</Routes>
);
Expand Down
Loading
Loading