Skip to content

Commit

Permalink
fix: ✨ let bundestag.io admin work again :)
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Ruck <[email protected]>
  • Loading branch information
Manuel Ruck committed Oct 29, 2023
1 parent 902cd74 commit 89f4cd2
Show file tree
Hide file tree
Showing 39 changed files with 1,526 additions and 2,750 deletions.
55 changes: 0 additions & 55 deletions .github/workflows/deploy-bundestag.io-admin.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
paths:
- 'services/**'
- 'bundestag.io/**'
branches:
- 'master'

Expand Down
3 changes: 2 additions & 1 deletion bundestag.io/admin/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": ["next", "next/core-web-vitals"],
"rules": {
"react/display-name": 0
"react/display-name": 0,
"@typescript-eslint/no-explicit-any": ["warn"]
}
}
41 changes: 0 additions & 41 deletions bundestag.io/admin/Dockerfile

This file was deleted.

7 changes: 3 additions & 4 deletions bundestag.io/admin/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
const App = ({ children }) => (
<main>
{children}
<style jsx global>{`
<style>{`
* {
font-family: Menlo, Monaco, "Lucida Console", "Liberation Mono",
"DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New",
monospace, serif;
font-family: Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono',
'Courier New', monospace, serif;
}
body {
margin: 0;
Expand Down
14 changes: 3 additions & 11 deletions bundestag.io/admin/components/Form/DatePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Form, DatePicker as AntDatePicker } from "antd";
import { Form, DatePicker as AntDatePicker } from 'antd';

const FormItem = Form.Item;

export const DatePicker = ({
field, // { name, value, onChange, onBlur }
form: { touched, errors, setFieldValue, setFieldTouched }, // also values, setXXXX, handleXXXX, dirty, isValid, status, etc.
itemProps,
onChange,
onBlur,
...props
}) => {
const handleChange = (value) => {
Expand All @@ -18,16 +16,10 @@ export const DatePicker = ({
setFieldTouched(field.name, !status);
};

const errorMsg =
touched[field.name] && errors[field.name] ? errors[field.name] : false;
const errorMsg = touched[field.name] && errors[field.name] ? errors[field.name] : false;

return (
<FormItem
{...itemProps}
validateStatus={
errorMsg ? "error" : touched[field.name] ? "success" : null
}
>
<FormItem {...itemProps} validateStatus={errorMsg ? 'error' : touched[field.name] ? 'success' : null}>
<AntDatePicker
{...field}
{...props}
Expand Down
10 changes: 3 additions & 7 deletions bundestag.io/admin/components/Form/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
import { Form, Input as AntInput } from "antd";
import { Form, Input as AntInput } from 'antd';

const FormItem = Form.Item;

export const Input = ({
field, // { name, value, onChange, onBlur }
form: { touched, errors, setFieldValue }, // also values, setXXXX, handleXXXX, dirty, isValid, status, etc.
itemProps,
onChange,
...props
}) => {
const handleChange = (value) => {
setFieldValue(field.name, value);
};

const errorMsg =
touched[field.name] && errors[field.name] ? errors[field.name] : "";
const errorMsg = touched[field.name] && errors[field.name] ? errors[field.name] : '';

return (
<FormItem
{...itemProps}
help={errorMsg}
validateStatus={
errorMsg ? "error" : touched[field.name] ? "success" : null
}
validateStatus={errorMsg ? 'error' : touched[field.name] ? 'success' : null}
hasFeedback
>
<AntInput {...field} {...props} onChange={handleChange} />
Expand Down
10 changes: 3 additions & 7 deletions bundestag.io/admin/components/Form/InputNumber.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
import { Form, InputNumber as AntInputNumber } from "antd";
import { Form, InputNumber as AntInputNumber } from 'antd';

const FormItem = Form.Item;

export const InputNumber = ({
field, // { name, value, onChange, onBlur }
form: { touched, errors, setFieldValue }, // also values, setXXXX, handleXXXX, dirty, isValid, status, etc.
itemProps,
onChange,
...props
}) => {
const handleChange = (value) => {
setFieldValue(field.name, value);
};

const errorMsg =
touched[field.name] && errors[field.name] ? errors[field.name] : "";
const errorMsg = touched[field.name] && errors[field.name] ? errors[field.name] : '';

return (
<FormItem
{...itemProps}
help={errorMsg}
validateStatus={
errorMsg ? "error" : touched[field.name] ? "success" : null
}
validateStatus={errorMsg ? 'error' : touched[field.name] ? 'success' : null}
hasFeedback
>
<AntInputNumber {...field} {...props} onChange={handleChange} />
Expand Down
22 changes: 12 additions & 10 deletions bundestag.io/admin/components/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import Head from "next/head";
import { Layout as AntLayout, Menu, Breadcrumb } from "antd";
import Head from 'next/head';
import { Layout as AntLayout, Breadcrumb } from 'antd';

import { Navigation } from "../Navigation";
import { Navigation } from '../Navigation';

const { Header, Content, Footer } = AntLayout;
const { Content } = AntLayout;

export const Layout: React.FC = ({ children }) => (
type Props = {
children: React.ReactNode;
};

export const Layout: React.FC<Props> = ({ children }) => (
<>
<Head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand All @@ -14,13 +18,11 @@ export const Layout: React.FC = ({ children }) => (
</Head>
<AntLayout>
<Navigation />
<Content style={{ padding: "0 50px" }}>
<Breadcrumb style={{ margin: "16px 0" }}>
<Content style={{ padding: '0 50px' }}>
<Breadcrumb style={{ margin: '16px 0' }}>
<Breadcrumb.Item>Backend</Breadcrumb.Item>
</Breadcrumb>
<div style={{ background: "#fff", padding: 24, minHeight: 280 }}>
{children}
</div>
<div style={{ background: '#fff', padding: 24, minHeight: 280 }}>{children}</div>
</Content>
</AntLayout>
</>
Expand Down
29 changes: 11 additions & 18 deletions bundestag.io/admin/components/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import styled from "styled-components";
import { useRouter } from "next/router";
import { Layout, Menu } from "antd";
import Link from "next/link";
import Icon from "@ant-design/icons/lib/components/Icon";
import { signout } from "next-auth/client";
import { useRouter } from 'next/router';
import { Layout, Menu } from 'antd';
import Link from 'next/link';
import Icon from '@ant-design/icons/lib/components/Icon';
import { signOut } from 'next-auth/react';

const { Header, Sider } = Layout;

// import Link from "./Link";

const Wrapper = styled.header`
margin-bottom: 25px;
`;
const { Sider } = Layout;

export const Navigation = () => {
const router = useRouter();
Expand All @@ -26,34 +19,34 @@ export const Navigation = () => {
<div className="logo" />
<Menu theme="dark" mode="inline" defaultSelectedKeys={[router.pathname]}>
<Menu.Item key="/">
<Link href="/">
<Link href="/" legacyBehavior>
<a>
<Icon type="user" />
<span className="nav-text">Home</span>
</a>
</Link>
</Menu.Item>
<Menu.Item key="/procedures">
<Link href="/procedures">
<Link href="/procedures" legacyBehavior>
<a>
<Icon type="pie-chart" />
<span className="nav-text">Vorgänge</span>
</a>
</Link>
</Menu.Item>
<Menu.Item key="/signout" onClick={() => signout()}>
<Menu.Item key="/signout" onClick={() => signOut()}>
Ausloggen
</Menu.Item>
{/* <Menu.Item key="/fractions">
<Link href="/fractions">
<Link href="/fractions" legacyBehavior>
<a>
<Icon type="team" />
<span className="nav-text">Fraktionen</span>
</a>
</Link>
</Menu.Item>
<Menu.Item key="/periods">
<Link href="/periods">
<Link href="/periods" legacyBehavior>
<a>
<Icon type="global" />
<span className="nav-text">Legislaturen</span>
Expand Down
Loading

0 comments on commit 89f4cd2

Please sign in to comment.