#20 Run prettier on the whole redaktions-app source
This commit is contained in:
parent
fbc9376575
commit
fc7fc9f841
|
@ -1,7 +1,7 @@
|
|||
# Redaktions App
|
||||
|
||||
The "Redaktions App" or editor's app is the main gateway for editors and candidates to alter the database,
|
||||
e.g. adding new questions (editors) and answering them (candidates).
|
||||
The "Redaktions App" or editor's app is the main gateway for editors and candidates to alter the database, e.g. adding
|
||||
new questions (editors) and answering them (candidates).
|
||||
|
||||
## Development
|
||||
|
||||
|
@ -18,8 +18,8 @@ The app is written in typescript and react and uses apollo to query the backend
|
|||
```shell script
|
||||
docker-compose up
|
||||
```
|
||||
which will start the whole setup including this app in a dockerfile.
|
||||
However, rebuilding and restarting this image can be cumbersome and is not necessary in the development setup.
|
||||
which will start the whole setup including this app in a dockerfile. However, rebuilding and restarting this image can
|
||||
be cumbersome and is not necessary in the development setup.
|
||||
- Instead run
|
||||
```shell script
|
||||
npm start
|
||||
|
@ -38,13 +38,14 @@ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|||
The page will reload if you make edits.<br>
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
Running the app without the backend server makes little sense.
|
||||
Start it under [http://localhost:5000](http://localhost:5000) as specified in the Readme of the backend server (../backend)
|
||||
Running the app without the backend server makes little sense. Start it
|
||||
under [http://localhost:5000](http://localhost:5000) as specified in the Readme of the backend server (../backend)
|
||||
|
||||
##### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.<br>
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more
|
||||
information.
|
||||
|
||||
##### `npm run build`
|
||||
|
||||
|
@ -60,8 +61,13 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
|
|||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will
|
||||
remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right
|
||||
into your project so you have full control over them. All of the commands except `eject` will still work, but they will
|
||||
point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you
|
||||
shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t
|
||||
customize it when you are ready for it.
|
||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
22043
redaktions-app/package-lock.json
generated
22043
redaktions-app/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -32,7 +32,7 @@
|
|||
"husky": "^4.3.6",
|
||||
"jest-environment-jsdom-sixteen": "^1.0.3",
|
||||
"lint-staged": "^10.5.3",
|
||||
"prettier": "^2.2.1"
|
||||
"prettier": "^2.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
|
|
|
@ -103,18 +103,17 @@ const getDeletedCategoryMock = (): DeleteCategoryPayload | null => {
|
|||
: null;
|
||||
};
|
||||
|
||||
export const deleteCategoryMock: Array<
|
||||
MockedResponse<DeleteCategoryResponse>
|
||||
> = [
|
||||
{
|
||||
request: {
|
||||
query: DELETE_CATEGORY,
|
||||
variables: deleteCategoryVariables,
|
||||
},
|
||||
result: {
|
||||
data: {
|
||||
deleteCategory: getDeletedCategoryMock(),
|
||||
export const deleteCategoryMock: Array<MockedResponse<DeleteCategoryResponse>> =
|
||||
[
|
||||
{
|
||||
request: {
|
||||
query: DELETE_CATEGORY,
|
||||
variables: deleteCategoryVariables,
|
||||
},
|
||||
result: {
|
||||
data: {
|
||||
deleteCategory: getDeletedCategoryMock(),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
];
|
||||
|
|
|
@ -116,18 +116,17 @@ const getDeletedQuestionMock = (): DeleteQuestionPayload | null => {
|
|||
: null;
|
||||
};
|
||||
|
||||
export const deleteQuestionMock: Array<
|
||||
MockedResponse<DeleteQuestionResponse>
|
||||
> = [
|
||||
{
|
||||
request: {
|
||||
query: DELETE_QUESTION,
|
||||
variables: deleteQuestionVariables,
|
||||
},
|
||||
result: {
|
||||
data: {
|
||||
deleteQuestion: getDeletedQuestionMock(),
|
||||
export const deleteQuestionMock: Array<MockedResponse<DeleteQuestionResponse>> =
|
||||
[
|
||||
{
|
||||
request: {
|
||||
query: DELETE_QUESTION,
|
||||
variables: deleteQuestionVariables,
|
||||
},
|
||||
result: {
|
||||
data: {
|
||||
deleteQuestion: getDeletedQuestionMock(),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
];
|
||||
|
|
|
@ -67,54 +67,55 @@ export const getPersonsSortedByRoleAllFilledMock: Array<
|
|||
},
|
||||
];
|
||||
|
||||
export const getPersonsByRoleNoCandidatesData: GetPersonsSortedByRoleResponse = {
|
||||
editors: {
|
||||
nodes: [
|
||||
{
|
||||
id: "WyJwZW9wbGUiLDFd",
|
||||
rowId: 1,
|
||||
firstName: "Erika",
|
||||
lastName: "Mustermann",
|
||||
role: "CANDYMAT_EDITOR",
|
||||
__typename: "Person",
|
||||
},
|
||||
],
|
||||
__typename: "PeopleConnection",
|
||||
},
|
||||
candidates: {
|
||||
nodes: [],
|
||||
__typename: "PeopleConnection",
|
||||
},
|
||||
users: {
|
||||
nodes: [
|
||||
{
|
||||
id: "WyJwZW9wbGUiLDJd",
|
||||
rowId: 2,
|
||||
firstName: "Max",
|
||||
lastName: "Mustermann",
|
||||
role: "CANDYMAT_PERSON",
|
||||
__typename: "Person",
|
||||
},
|
||||
{
|
||||
id: "WyJwZW9wbGUiLDNd",
|
||||
rowId: 3,
|
||||
firstName: "Tricia",
|
||||
lastName: "McMillan",
|
||||
role: "CANDYMAT_PERSON",
|
||||
__typename: "Person",
|
||||
},
|
||||
{
|
||||
id: "WyJwZW9wbGUiLDRd",
|
||||
rowId: 4,
|
||||
firstName: "Happy",
|
||||
lastName: "User",
|
||||
role: "CANDYMAT_PERSON",
|
||||
__typename: "Person",
|
||||
},
|
||||
],
|
||||
__typename: "PeopleConnection",
|
||||
},
|
||||
};
|
||||
export const getPersonsByRoleNoCandidatesData: GetPersonsSortedByRoleResponse =
|
||||
{
|
||||
editors: {
|
||||
nodes: [
|
||||
{
|
||||
id: "WyJwZW9wbGUiLDFd",
|
||||
rowId: 1,
|
||||
firstName: "Erika",
|
||||
lastName: "Mustermann",
|
||||
role: "CANDYMAT_EDITOR",
|
||||
__typename: "Person",
|
||||
},
|
||||
],
|
||||
__typename: "PeopleConnection",
|
||||
},
|
||||
candidates: {
|
||||
nodes: [],
|
||||
__typename: "PeopleConnection",
|
||||
},
|
||||
users: {
|
||||
nodes: [
|
||||
{
|
||||
id: "WyJwZW9wbGUiLDJd",
|
||||
rowId: 2,
|
||||
firstName: "Max",
|
||||
lastName: "Mustermann",
|
||||
role: "CANDYMAT_PERSON",
|
||||
__typename: "Person",
|
||||
},
|
||||
{
|
||||
id: "WyJwZW9wbGUiLDNd",
|
||||
rowId: 3,
|
||||
firstName: "Tricia",
|
||||
lastName: "McMillan",
|
||||
role: "CANDYMAT_PERSON",
|
||||
__typename: "Person",
|
||||
},
|
||||
{
|
||||
id: "WyJwZW9wbGUiLDRd",
|
||||
rowId: 4,
|
||||
firstName: "Happy",
|
||||
lastName: "User",
|
||||
role: "CANDYMAT_PERSON",
|
||||
__typename: "Person",
|
||||
},
|
||||
],
|
||||
__typename: "PeopleConnection",
|
||||
},
|
||||
};
|
||||
|
||||
export const getPersonsSortedByRoleNoCandidatesMock: Array<
|
||||
MockedResponse<GetPersonsSortedByRoleResponse>
|
||||
|
|
|
@ -36,7 +36,9 @@ interface AccordionWithEditProps {
|
|||
title: string;
|
||||
description: string | null;
|
||||
subTitle?: string | null;
|
||||
|
||||
onEditButtonClick?(): void;
|
||||
|
||||
onDeleteButtonClick?(): void;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ const useStyles = makeStyles((theme) => ({
|
|||
}));
|
||||
|
||||
export default function CategoryList(): React.ReactElement {
|
||||
const categories = useQuery<GetAllCategoriesResponse, null>(
|
||||
GET_ALL_CATEGORIES
|
||||
).data?.allCategories.nodes;
|
||||
const categories =
|
||||
useQuery<GetAllCategoriesResponse, null>(GET_ALL_CATEGORIES).data
|
||||
?.allCategories.nodes;
|
||||
const classes = useStyles();
|
||||
|
||||
const handleAddClick = () => {
|
||||
|
|
|
@ -52,9 +52,9 @@ export default function DialogChangeQuestion(): React.ReactElement {
|
|||
},
|
||||
}
|
||||
);
|
||||
const categories = useQuery<GetAllCategoriesResponse, null>(
|
||||
GET_ALL_CATEGORIES
|
||||
).data?.allCategories.nodes;
|
||||
const categories =
|
||||
useQuery<GetAllCategoriesResponse, null>(GET_ALL_CATEGORIES).data
|
||||
?.allCategories.nodes;
|
||||
|
||||
const [editQuestion, { loading: editLoading }] = useMutation<
|
||||
EditQuestionResponse,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Avatar, Paper, Typography } from "@material-ui/core";
|
||||
import EditIcon from "@material-ui/icons/Edit";
|
||||
import React from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import ChangeRole from "./ChangeRole";
|
||||
|
|
|
@ -28,8 +28,9 @@ const useStyles = makeStyles((theme) => ({
|
|||
}));
|
||||
|
||||
export default function QuestionList(): React.ReactElement {
|
||||
const questions = useQuery<GetAllQuestionsResponse, null>(GET_ALL_QUESTIONS)
|
||||
.data?.allQuestions.nodes;
|
||||
const questions =
|
||||
useQuery<GetAllQuestionsResponse, null>(GET_ALL_QUESTIONS).data
|
||||
?.allQuestions.nodes;
|
||||
const classes = useStyles();
|
||||
|
||||
const handleAddButtonClick = () => {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
||||
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||
sans-serif;
|
||||
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
|
||||
monospace;
|
||||
monospace;
|
||||
}
|
||||
|
|
|
@ -54,9 +54,10 @@ export const queryAllIconButtons = (
|
|||
iconPath: string,
|
||||
container?: HTMLElement
|
||||
): HTMLElement[] => {
|
||||
return (container
|
||||
? queryAllByRole(container, "button")
|
||||
: screen.queryAllByRole("button")
|
||||
return (
|
||||
container
|
||||
? queryAllByRole(container, "button")
|
||||
: screen.queryAllByRole("button")
|
||||
).filter(
|
||||
(button) =>
|
||||
button.innerHTML.includes("svg") && button.innerHTML.includes(iconPath)
|
||||
|
|
|
@ -31,7 +31,8 @@ describe("The UserManagement page", () => {
|
|||
expect(editor).not.toBeNull();
|
||||
|
||||
const candidatesSectionTitle = await screen.findByText(/KandidatInnen/);
|
||||
const candidatesSection = candidatesSectionTitle.parentElement as HTMLElement;
|
||||
const candidatesSection =
|
||||
candidatesSectionTitle.parentElement as HTMLElement;
|
||||
const candidate1 = await findByText(candidatesSection, /Max Mustermann/);
|
||||
const candidate2 = await findByText(candidatesSection, /Tricia McMillan/);
|
||||
expect(candidate1).not.toBeNull();
|
||||
|
@ -52,11 +53,13 @@ describe("The UserManagement page", () => {
|
|||
expect(editor).not.toBeNull();
|
||||
|
||||
const candidatesSectionTitle = await screen.findByText(/Kandidat/);
|
||||
const candidatesSection = candidatesSectionTitle.parentElement as HTMLElement;
|
||||
const candidatesSection =
|
||||
candidatesSectionTitle.parentElement as HTMLElement;
|
||||
expect(candidatesSection.childElementCount).toBe(1);
|
||||
|
||||
const otherUsersSectionTitle = await screen.findByText(/Andere/);
|
||||
const otherUsersSection = otherUsersSectionTitle.parentElement as HTMLElement;
|
||||
const otherUsersSection =
|
||||
otherUsersSectionTitle.parentElement as HTMLElement;
|
||||
const otherUser1 = await findByText(otherUsersSection, /Max Mustermann/);
|
||||
const otherUser2 = await findByText(otherUsersSection, /Tricia McMillan/);
|
||||
const otherUser3 = await findByText(otherUsersSection, /Happy User/);
|
||||
|
|
Loading…
Reference in a new issue