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

Fix/search #566

Merged
merged 5 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 3 additions & 12 deletions democracy/desktop/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"root": true,
// Configuration for JavaScript files
"extends": [
"airbnb-base",
"next/core-web-vitals",
"plugin:prettier/recommended"
],
"extends": ["airbnb-base", "next/core-web-vitals", "plugin:prettier/recommended"],
"rules": {
"prettier/prettier": [
"error",
Expand All @@ -25,9 +22,6 @@
"next/core-web-vitals",
"plugin:prettier/recommended"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"prettier/prettier": [
"error",
Expand Down Expand Up @@ -70,10 +64,7 @@
], // Follow the same ordering as the official plugin `prettier-plugin-tailwindcss`
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{ "argsIgnorePattern": "^_" }
]
"unused-imports/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
}
}
]
Expand Down
113 changes: 58 additions & 55 deletions democracy/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,63 +13,66 @@
"build-types": "tsc --noEmit --pretty"
},
"dependencies": {
"@apollo/client": "^3.5.10",
"@badrap/bar-of-progress": "^0.1.2",
"@headlessui/react": "^1.5.0",
"@heroicons/react": "^1.0.6",
"@tailwindcss/forms": "^0.5.0",
"@tailwindcss/line-clamp": "^0.3.1",
"@tailwindcss/typography": "^0.5.2",
"@types/d3": "^5.7.0",
"accounting": "^0.4.1",
"apollo-link-debounce": "^3.0.0",
"axios": "^1.6.0",
"chart.js": "^3.7.1",
"d3": "^5.7.0",
"dayjs": "^1.11.0",
"graphql": "^16.3.0",
"lodash-es": "^4.17.21",
"next": "^12.1.4",
"next-seo": "^5.4.0",
"react": "^17.0.2",
"react-chartjs-2": "^4.1.0",
"react-cool-dimensions": "^2.0.7",
"react-dom": "^17.0.2",
"react-infinite-scroll-hook": "^4.0.3",
"react-use": "^17.3.2",
"recoil": "^0.7.0",
"sharp": "^0.30.4",
"slug": "^5.3.0"
"@apollo/client": "3.8.6",
"@badrap/bar-of-progress": "0.1.2",
"@headlessui/react": "1.7.17",
"@heroicons/react": "1.0.6",
"@tailwindcss/forms": "0.5.6",
"@tailwindcss/line-clamp": "0.3.1",
"@tailwindcss/typography": "0.5.10",
"@types/d3": "5.16.6",
"@yarnpkg/lockfile": "1.1.0",
"accounting": "0.4.1",
"apollo-link-debounce": "3.0.0",
"axios": "1.6.0",
"chart.js": "3.9.1",
"d3": "5.16.0",
"dayjs": "1.11.10",
"graphql": "16.8.1",
"lodash-es": "4.17.21",
"next": "12.3.4",
"next-seo": "5.15.0",
"react": "17.0.2",
"react-chartjs-2": "4.3.1",
"react-cool-dimensions": "2.0.7",
"react-dom": "17.0.2",
"react-infinite-scroll-hook": "4.1.1",
"react-use": "17.4.0",
"recoil": "0.7.7",
"sharp": "0.30.7",
"slug": "5.3.0"
},
"devDependencies": {
"@next/bundle-analyzer": "^12.1.4",
"@types/lodash-es": "^4.17.6",
"@types/node": "^17.0.23",
"@types/react": "^17.0.44",
"@types/slug": "^5.0.3",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"autoprefixer": "^10.4.4",
"cross-env": "^7.0.3",
"cssnano": "^5.1.7",
"eslint": "^8.13.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-next": "^12.1.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.4.0",
"eslint-plugin-tailwindcss": "^3.5.0",
"eslint-plugin-unused-imports": "^2.0.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.12",
"prettier": "^2.6.2",
"rimraf": "^3.0.2",
"tailwindcss": "^3.0.23",
"typescript": "^4.6.3"
"@next/bundle-analyzer": "12.3.4",
"@types/lodash-es": "4.17.10",
"@types/node": "17.0.45",
"@types/react": "17.0.69",
"@types/slug": "5.0.6",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"autoprefixer": "10.4.16",
"cross-env": "7.0.3",
"cssnano": "5.1.15",
"eslint": "8.52.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-airbnb-typescript": "17.1.0",
"eslint-config-next": "12.3.4",
"eslint-config-prettier": "8.10.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-tailwindcss": "3.13.0",
"eslint-plugin-unused-imports": "2.0.0",
"husky": "7.0.4",
"lint-staged": "12.5.0",
"npm-run-all": "4.1.5",
"postcss": "8.4.31",
"prettier": "2.8.8",
"rimraf": "3.0.2",
"tailwindcss": "3.3.5",
"typescript": "4.9.5"
},
"license": "ISC"
}
48 changes: 13 additions & 35 deletions democracy/desktop/src/components/molecules/ChartPair.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { useEffect, useRef, useState } from 'react';

import { formatVotes } from '@/utils/Helpers';

import DoughnutChart, {
PartyVote,
VoteCategory,
Votes,
} from '../organisms/DoughnutChart';
import DoughnutChart, { PartyVote, VoteCategory, Votes } from '../organisms/DoughnutChart';

function sortPartyVotes(partyVotes: PartyVote[], key: string) {
try {
Expand Down Expand Up @@ -102,10 +98,10 @@ export default function ChartPair({ item, className, large }) {
partyVotes: item.voteResults.partyVotes.map((p: any) => ({
party: p.party,
main: p.main.toLowerCase(),
yes: p.deviants.yes ?? 0,
no: p.deviants.no ?? 0,
abstination: p.deviants.abstination ?? 0,
notVoted: p.deviants.notVoted ?? 0,
yes: p.deviants?.yes ?? 0,
no: p.deviants?.no ?? 0,
abstination: p.deviants?.abstination ?? 0,
notVoted: p.deviants?.notVoted ?? 0,
})),
}
: undefined;
Expand All @@ -117,12 +113,7 @@ export default function ChartPair({ item, className, large }) {
setDelay(setTimeout(() => close(), 500));
}}
>
<div
ref={ref}
className={`flex gap-6 p-2 ${
hover1 ? 'bg-white rounded-md overflow-hidden shadow' : ''
}`}
>
<div ref={ref} className={`flex gap-6 p-2 ${hover1 ? 'bg-white rounded-md overflow-hidden shadow' : ''}`}>
{item.voteResults && (
<div className="flex flex-col items-center">
<DoughnutChart
Expand All @@ -134,9 +125,7 @@ export default function ChartPair({ item, className, large }) {
setDelay(setTimeout(() => close(), 500));
} else {
setHover1(item1);
setPartyVotes(
sortPartyVotes(officialVotes?.partyVotes ?? [], k1!)
);
setPartyVotes(sortPartyVotes(officialVotes?.partyVotes ?? [], k1!));
setKey1(k1 ?? undefined);
}
}}
Expand All @@ -153,14 +142,12 @@ export default function ChartPair({ item, className, large }) {
item.voteResults.yes +
item.voteResults.no +
item.voteResults.abstination +
item.voteResults.notVoted
item.voteResults.notVoted,
)})`}
{!hover1 && (
<span>
{item.voteResults.namedVote
? `${formatVotes(
item.voteResults.yes + item.voteResults.no
)} Abgeordnete`
? `${formatVotes(item.voteResults.yes + item.voteResults.no)} Abgeordnete`
: `${item.voteResults.partyVotes.length} Fraktionen`}
</span>
)}
Expand Down Expand Up @@ -202,9 +189,7 @@ export default function ChartPair({ item, className, large }) {
{hover2
? `${hover2.label} (${calculatePercent(
hover2.count,
item.communityVotes.yes +
item.communityVotes.no +
item.communityVotes.abstination
item.communityVotes.yes + item.communityVotes.no + item.communityVotes.abstination,
)})`
: formatVotes(item.votes)}
{!hover2 && ' Nutzer'}
Expand All @@ -218,15 +203,10 @@ export default function ChartPair({ item, className, large }) {
{hover1.label}
</span> */}
{partyVotes.map((p) => (
<div
key={p.party}
className="flex w-full items-center justify-between pb-px"
>
<div key={p.party} className="flex w-full items-center justify-between pb-px">
<img
src={`/img/parteilogos/unified/${slug(p.party)}.svg`}
className={`${
large ? 'h-6 w-20' : 'h-5 w-14'
} object-cover text-xs italic`}
className={`${large ? 'h-6 w-20' : 'h-5 w-14'} object-cover text-xs italic`}
alt={p.party}
/>
<div className="h-full w-full pl-1 text-right text-gray-700">
Expand All @@ -245,9 +225,7 @@ export default function ChartPair({ item, className, large }) {
}}
className="flex h-full"
></div> */}
<small className="absolute inset-0 px-1">
{p[key1!]}
</small>
<small className="absolute inset-0 px-1">{p[key1!]}</small>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions democracy/desktop/src/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FC, ReactNode } from 'react';
import { FC } from 'react';

import Navigation from '@/components/molecules/Navigation';
import DonateDialog from '@/components/organisms/DonateDialog';

interface Props {
children: ReactNode;
children: React.ReactNode;
}

const Layout: FC<Props> = ({ children }) => (
Expand Down
6 changes: 2 additions & 4 deletions democracy/desktop/src/templates/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { ReactNode } from 'react';

import { AppConfig } from '@/utils/AppConfig';

type IMainProps = {
meta: ReactNode;
children: ReactNode;
meta: React.ReactNode;
children: React.ReactNode;
};

const Main = (props: IMainProps) => (
Expand Down
47 changes: 16 additions & 31 deletions democracy/desktop/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,31 @@
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"removeComments": true,
"preserveConstEnums": true,
"strict": true,
"alwaysStrict": true,
"strictNullChecks": true,
"noUncheckedIndexedAccess": true,

"noImplicitAny": false,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowUnreachableCode": false,
"noFallthroughCasesInSwitch": true,

"target": "es5",
"outDir": "out",
"declaration": true,
"sourceMap": true,

"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"allowJs": false,
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,

"jsx": "preserve",
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,

"plugins": [
{
"name": "next"
}
],
"strictNullChecks": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@/public/*": ["./public/*"]
}
},
"exclude": ["./out/**/*", "./node_modules/**/*"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
Loading
Loading