From 0638167ca46f190453974db67e8203aa3d86176e Mon Sep 17 00:00:00 2001
From: Aarni Halinen
Date: Fri, 15 Jan 2021 22:10:39 +0200
Subject: [PATCH] Fix lint
---
src/components/Accordion/Accordion.tsx | 6 +-
src/components/Accordion/AccordionIcon.tsx | 4 +-
src/components/AddLink.tsx | 8 +-
src/components/AdminSidebar.tsx | 16 +--
src/components/Button.tsx | 6 +-
src/components/Card.tsx | 12 +-
src/components/CommitteeContainer.tsx | 14 +--
src/components/ContactCard.tsx | 42 +++----
src/components/DropDownBox.tsx | 4 +-
src/components/Favicons.tsx | 99 ++++++++--------
src/components/Footer/Footer.tsx | 2 +-
src/components/Footer/FooterContent.tsx | 2 +-
src/components/HTMLLogo.tsx | 10 +-
src/components/Header.tsx | 10 +-
src/components/HeaderLogo.tsx | 2 +-
src/components/Hero/Hero.tsx | 4 +-
src/components/Hero/HeroAside.tsx | 24 ++--
src/components/Hero/HeroPrimaryButtons.tsx | 4 +-
src/components/Hero/HeroPrimarySection.tsx | 4 +-
src/components/Hero/HeroSecondarySection.tsx | 8 +-
src/components/Hero/index.tsx | 4 +-
src/components/Icon.tsx | 23 ++--
src/components/InfoBox.tsx | 2 +-
src/components/Link.tsx | 20 ++--
src/components/NavbarChildLink.tsx | 4 +-
src/components/NavbarDropdownLink.tsx | 8 +-
src/components/Navigation.tsx | 38 +++----
src/components/NavigationMobile.tsx | 36 +++---
src/components/Sections/CTASection.tsx | 23 ++--
src/components/Sections/FullWidthSection.tsx | 2 +-
src/components/Sections/TextSection.tsx | 2 +-
src/components/Widgets/Checkbox/Checkbox.tsx | 8 +-
.../Widgets/Checkbox/Checkboxes.tsx | 23 ++--
src/components/Widgets/DatetimeWidget.tsx | 12 +-
.../Widgets/MarkdownEditorWidget.tsx | 8 +-
.../Widgets/RadioButton/RadioButton.tsx | 2 +-
.../Widgets/RadioButton/RadioButtonWidget.tsx | 10 +-
.../Widgets/SectionDividerWidget.tsx | 6 +-
.../SignupQuestionsWidget/OptionsWidget.tsx | 56 +++++----
.../SignupQuestionsWidget/QuestionList.tsx | 14 ++-
.../SignupQuestionsWidget.tsx | 13 ++-
.../SignupQuestionsWidget/TypeWidget.tsx | 8 +-
.../Widgets/SignupQuestionsWidget/index.ts | 2 +-
src/models/Event.ts | 36 +++---
src/models/Feed.ts | 28 ++---
src/models/JobAd.ts | 42 +++----
src/models/Signup.ts | 43 +++----
src/models/SignupForm.ts | 22 ++--
src/models/Tag.ts | 2 +-
src/pages/_app.tsx | 46 ++++----
src/pages/admin/events/[id].tsx | 60 +++++-----
src/pages/admin/events/index.tsx | 12 +-
src/pages/admin/feed/[id].tsx | 41 +++----
src/pages/admin/feed/index.tsx | 10 +-
src/pages/admin/index.tsx | 26 ++---
src/pages/admin/jobads/[id].tsx | 32 +++---
src/pages/admin/jobads/index.tsx | 19 ++--
src/pages/admin/login.tsx | 14 ++-
src/pages/admin/logout.tsx | 2 +-
src/pages/admin/signups/[id].tsx | 36 +++---
src/pages/admin/signups/[id]/email.tsx | 71 ++++++------
src/pages/admin/signups/[id]/list.tsx | 30 +++--
src/pages/admin/signups/index.tsx | 10 +-
src/pages/events/[id].tsx | 10 +-
src/pages/in_english.tsx | 2 +-
src/pages/index.tsx | 13 ++-
src/pages/kilta/fuksi.tsx | 2 +-
src/pages/kilta/kunnia.tsx | 2 +-
src/pages/kilta/toiminta.tsx | 14 ++-
src/pages/signup/[...params].tsx | 39 ++++---
src/pages/yritysyhteistyo.tsx | 17 +--
src/theme/breakpoints.ts | 8 +-
src/theme/colors.ts | 16 +--
src/utils/auth.ts | 2 +-
src/utils/regexes.ts | 3 +-
src/views/ActualPage/ActualPageHero.tsx | 40 ++++---
src/views/ActualPage/ActualPageView.tsx | 107 +++++++++---------
src/views/ActualPage/EventCalendar.tsx | 29 +++--
src/views/ActualPage/FilterContainer.tsx | 2 +-
src/views/ActualPage/News.tsx | 29 +++--
src/views/ContactsPage/ContactsPageView.tsx | 26 ++---
src/views/CorporatePage/CorporatePageHero.tsx | 13 ++-
src/views/CorporatePage/CorporatePageView.tsx | 8 +-
src/views/CorporatePage/JobAdList.tsx | 2 +-
src/views/EventPage/EventPageView.tsx | 13 +--
src/views/FreshmenPage/FreshmenPageHero.tsx | 16 ++-
src/views/FreshmenPage/FreshmenPageView.tsx | 12 +-
src/views/FrontPage/FrontPageHero.tsx | 10 +-
src/views/FrontPage/FrontPageView.tsx | 18 ++-
src/views/GuildPage/GuildPageHero.tsx | 16 +--
src/views/GuildPage/GuildPageView.tsx | 9 +-
src/views/InEnglishPage/InEnglishPageHero.tsx | 4 +-
src/views/SignUpPage/FormUtils.tsx | 81 ++++++-------
src/views/SignUpPage/SignUpPageView.tsx | 39 +++----
src/views/StudiesPage/StudiesPageHero.tsx | 4 +-
src/views/StudiesPage/StudiesPageView.tsx | 18 +--
src/views/admin/AdminCreateCommon.tsx | 9 +-
src/views/admin/AdminListCommon.tsx | 2 +-
src/views/common/AdminPageWrapper.tsx | 12 +-
src/views/common/FormWrapper.tsx | 2 +-
src/views/common/PageWrapper.tsx | 4 +-
101 files changed, 953 insertions(+), 887 deletions(-)
diff --git a/src/components/Accordion/Accordion.tsx b/src/components/Accordion/Accordion.tsx
index e8bfb37..dc0e766 100644
--- a/src/components/Accordion/Accordion.tsx
+++ b/src/components/Accordion/Accordion.tsx
@@ -39,7 +39,7 @@ const Container = styled.div`
`;
const Panel = styled.div<{visible?: boolean}>`
- margin-top: ${(p) => p.visible ? "0" : "-100%"};
+ margin-top: ${(p) => (p.visible ? "0" : "-100%")};
display: flex;
max-height: 15rem;
@@ -59,7 +59,7 @@ const Accordion: React.FC = ({ title, children }) => {
const handleClick = () => {
setOpen(!isOpen);
- }
+ };
return (
@@ -73,6 +73,6 @@ const Accordion: React.FC = ({ title, children }) => {
);
-}
+};
export default Accordion;
diff --git a/src/components/Accordion/AccordionIcon.tsx b/src/components/Accordion/AccordionIcon.tsx
index f984de4..4264b61 100644
--- a/src/components/Accordion/AccordionIcon.tsx
+++ b/src/components/Accordion/AccordionIcon.tsx
@@ -10,7 +10,7 @@ const Icon = styled.div`
display: flex;
justify-content: center;
align-items: center;
- background-color: ${(p) => p.open ? colors.orange1 : colors.blue1};
+ background-color: ${(p) => (p.open ? colors.orange1 : colors.blue1)};
color: ${colors.white};
min-width: 2.5rem;
max-width: 2.5rem;
@@ -27,7 +27,7 @@ const Icon = styled.div`
`;
-const AccordionIcon: React.FC = ({ open } ) => (
+const AccordionIcon: React.FC = ({ open }) => (
+
diff --git a/src/components/AddLink.tsx b/src/components/AddLink.tsx
index aa2f195..527cf91 100644
--- a/src/components/AddLink.tsx
+++ b/src/components/AddLink.tsx
@@ -1,6 +1,6 @@
import React, { ComponentProps } from "react";
import styled from "styled-components";
-import { colors }from "@theme/colors";
+import { colors } from "@theme/colors";
import { Link } from "@components/index";
const AddIcon = "/img/add-icon.png";
@@ -27,10 +27,10 @@ type AddLinkProps = ComponentProps & {
}
const AddLink: React.FC = ({ text, ...props }) => (
-
+
{text}
-)
+);
-export default AddLink;
\ No newline at end of file
+export default AddLink;
diff --git a/src/components/AdminSidebar.tsx b/src/components/AdminSidebar.tsx
index 16d87be..0ed9b18 100644
--- a/src/components/AdminSidebar.tsx
+++ b/src/components/AdminSidebar.tsx
@@ -30,7 +30,7 @@ const StyledLink = styled(Link)<{$path: string}>`
color: ${colors.white};
border-left: 4px solid transparent;
- ${p => p.$path === p.to && `
+ ${(p) => p.$path === p.to && `
border-left: 4px solid ${colors.white};
`}
@@ -45,13 +45,13 @@ const StyledLink = styled(Link)<{$path: string}>`
const AdminSidebar: React.FC = ({ path }) => (
- Home ›
- Events ›
- Feed ›
- Signup forms ›
- Job advertisements ›
- Files ›
- Logout ›
+ Home ›
+ Events ›
+ Feed ›
+ Signup forms ›
+ Job advertisements ›
+ Files ›
+ Logout ›
);
diff --git a/src/components/Button.tsx b/src/components/Button.tsx
index 59c08b9..3fc3ec3 100644
--- a/src/components/Button.tsx
+++ b/src/components/Button.tsx
@@ -62,8 +62,10 @@ const StyledButton = styled.button<{ $selected: boolean }>`
}
`;
-const Button: React.FC = ({ buttonStyle, selected, onClick, ...props }) => (
+const Button: React.FC = ({
+ buttonStyle, selected, onClick, ...props
+}) => (
-)
+);
export default Button;
diff --git a/src/components/Card.tsx b/src/components/Card.tsx
index bb2b472..7e8425c 100644
--- a/src/components/Card.tsx
+++ b/src/components/Card.tsx
@@ -65,13 +65,15 @@ const StyledCard = styled.article`
}
`;
-const WrappedCard: React.FC = ({ title, text, link, image, imageAlt, start_time, buttonOnClick, ...props }) => {
+const WrappedCard: React.FC = ({
+ title, text, link, image, imageAlt, start_time, buttonOnClick, ...props
+}) => {
const options = {
day: "numeric",
month: "numeric",
year: "numeric",
hour: "numeric",
- minute: "2-digit"
+ minute: "2-digit",
};
const datetime = new Date(start_time).toLocaleString("fi-FI", options);
const img = image ? (
@@ -80,8 +82,8 @@ const WrappedCard: React.FC = ({ title, text, link, image, ima
const button = (
-
- Lue lisää ›
+
+ Lue lisää ›
);
@@ -95,6 +97,6 @@ const WrappedCard: React.FC = ({ title, text, link, image, ima
{button}
);
-}
+};
export default WrappedCard;
diff --git a/src/components/CommitteeContainer.tsx b/src/components/CommitteeContainer.tsx
index 699420c..1c74722 100644
--- a/src/components/CommitteeContainer.tsx
+++ b/src/components/CommitteeContainer.tsx
@@ -1,7 +1,7 @@
import React from "react";
import styled from "styled-components";
import ContactCard from "./ContactCard";
-import { Committee } from "@views/ContactsPage/ContactsPageView"
+import { Committee } from "@views/ContactsPage/ContactsPageView";
import { colors } from "@theme/colors";
const blank_profile = "/img/blank_profile.png";
@@ -36,18 +36,18 @@ const Container = styled.div`
const CommitteeContainer: React.FC = ({ committee }) => (
- {committee.name_fi||committee.name_en}
+ {committee.name_fi || committee.name_en}
- {committee.roles.map(role => (
- role.representatives.map(representative => (
+ {committee.roles.map((role) => (
+ role.representatives.map((representative) => (
@@ -57,4 +57,4 @@ const CommitteeContainer: React.FC
= ({ committee }) =>
);
-export default CommitteeContainer;
\ No newline at end of file
+export default CommitteeContainer;
diff --git a/src/components/ContactCard.tsx b/src/components/ContactCard.tsx
index 38996a9..a16d24c 100644
--- a/src/components/ContactCard.tsx
+++ b/src/components/ContactCard.tsx
@@ -54,25 +54,25 @@ interface ContactCardProps {
role_en: string;
}
-const ContactCard: React.FC = ({ name, phone, email, image, role_fi, role_en }) => {
- return(
-
- {image ?
-
-
- : null
- }
-
- {name}
- {role_fi || role_en}
- {phone ? {phone}
: null}
- {email ? {email}
: null}
-
-
- )
-}
+const ContactCard: React.FC = ({
+ name, phone, email, image, role_fi, role_en,
+}) => (
+
+ {image ? (
+
+
+
+ ) : null}
+
+ {name}
+ {role_fi || role_en}
+ {phone ? {phone}
: null}
+ {email ? {email}
: null}
+
+
+);
-export default ContactCard;
\ No newline at end of file
+export default ContactCard;
diff --git a/src/components/DropDownBox.tsx b/src/components/DropDownBox.tsx
index 0194294..3a6425a 100644
--- a/src/components/DropDownBox.tsx
+++ b/src/components/DropDownBox.tsx
@@ -23,7 +23,9 @@ const Box = styled.div`
}
`;
-const DropDownBox: React.FC = ({ children, onMouseEnter, onMouseLeave, visible }) => (
+const DropDownBox: React.FC = ({
+ children, onMouseEnter, onMouseLeave, visible,
+}) => (
(
<>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
>
-);
\ No newline at end of file
+);
diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx
index 619c808..4d40c15 100644
--- a/src/components/Footer/Footer.tsx
+++ b/src/components/Footer/Footer.tsx
@@ -50,6 +50,6 @@ const Footer: React.FC = () => (
webmaster: sik-vtmk@list.ayy.fi
-)
+);
export default Footer;
diff --git a/src/components/Footer/FooterContent.tsx b/src/components/Footer/FooterContent.tsx
index 3188682..a3a03ac 100644
--- a/src/components/Footer/FooterContent.tsx
+++ b/src/components/Footer/FooterContent.tsx
@@ -100,6 +100,6 @@ const FooterContent: React.FC = () => (
/>
-)
+);
export default FooterContent;
diff --git a/src/components/HTMLLogo.tsx b/src/components/HTMLLogo.tsx
index bf7dfda..6101999 100644
--- a/src/components/HTMLLogo.tsx
+++ b/src/components/HTMLLogo.tsx
@@ -1,7 +1,9 @@
import React from "react";
+// eslint-disable-next-line react/display-name
export default (): JSX.Element => (
- (
:y\`/Nm. /do/- /M\` Nm/.M: sd-\`/M:\`hy++d+
/- .y+oN: sd NyhhM: om/-+m- .:-\`
\`-:- o+ h/ /h: -/+:\`
--->`}} />
-)
+-->`,
+ }}
+ />
+);
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 858f351..31d7cc6 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -24,13 +24,12 @@ const Sticky = styled.div<{$isHidden?: boolean}>`
background-color: ${colors.darkBlue};
transition: all 200ms ease-out;
- ${(p) => p.$isHidden ? (`
+ ${(p) => (p.$isHidden ? (`
transition: all 200ms ease-in;
transform: translateY(-100%);
- `) : null}
+ `) : null)}
`;
-
const PREVENT_IS_HIDDEN_Y = 150;
const Header: React.FC = () => {
@@ -58,7 +57,6 @@ const Header: React.FC = () => {
return () => window.removeEventListener("scroll", func);
}, [isHidden, mobileMenuOpen]);
-
return (
@@ -67,7 +65,7 @@ const Header: React.FC = () => {
- )
-}
+ );
+};
export default Header;
diff --git a/src/components/HeaderLogo.tsx b/src/components/HeaderLogo.tsx
index 7c58985..18d064d 100644
--- a/src/components/HeaderLogo.tsx
+++ b/src/components/HeaderLogo.tsx
@@ -23,6 +23,6 @@ const HeaderLogo: React.FC = () => (
alt="logo"
/>
-)
+);
export default HeaderLogo;
diff --git a/src/components/Hero/Hero.tsx b/src/components/Hero/Hero.tsx
index 2a39779..0f4b3c8 100644
--- a/src/components/Hero/Hero.tsx
+++ b/src/components/Hero/Hero.tsx
@@ -49,6 +49,6 @@ const Hero: React.FC = ({ children }) => (
{children}
-)
+);
-export default Hero;
\ No newline at end of file
+export default Hero;
diff --git a/src/components/Hero/HeroAside.tsx b/src/components/Hero/HeroAside.tsx
index 241e0a7..5490e15 100644
--- a/src/components/Hero/HeroAside.tsx
+++ b/src/components/Hero/HeroAside.tsx
@@ -14,7 +14,9 @@ const Article = styled.article`
margin-bottom: 1rem;
`;
-export const HeroAsideItem: React.FC = ({ header, text, link, linkText }) => (
+export const HeroAsideItem: React.FC = ({
+ header, text, link, linkText,
+}) => (
{header}
{text && (
@@ -26,7 +28,7 @@ export const HeroAsideItem: React.FC = ({ header, text, link
-)
+);
type Colors = "darkBlue" | "lightTurquoise";
@@ -73,27 +75,27 @@ const Aside = styled.aside<{ colors: string }>`
`;
const textColors = (bgColor: Colors) => {
- switch(bgColor) {
- case "darkBlue":
- return `
+ switch (bgColor) {
+ case "darkBlue":
+ return `
background-color: ${colors[bgColor]};
color: ${colors.lightBlue};
`;
- case "lightTurquoise":
- return `
+ case "lightTurquoise":
+ return `
background-color: ${colors[bgColor]};
color: ${colors.darkBlue};
`;
- default: return ""
+ default: return "";
}
-}
+};
-const HeroAside: React.FC = ({ bgColor, children}) => (
+const HeroAside: React.FC = ({ bgColor, children }) => (
-)
+);
export default HeroAside;
diff --git a/src/components/Hero/HeroPrimaryButtons.tsx b/src/components/Hero/HeroPrimaryButtons.tsx
index 251ad6f..8d87078 100644
--- a/src/components/Hero/HeroPrimaryButtons.tsx
+++ b/src/components/Hero/HeroPrimaryButtons.tsx
@@ -6,7 +6,7 @@ const Buttons = styled.div<{row?: boolean}>`
max-width: fit-content;
margin: auto;
display: flex;
- flex-flow: ${(p) => p.row ? "row" : "column"} wrap;
+ flex-flow: ${(p) => (p.row ? "row" : "column")} wrap;
a {
display: contents;
@@ -36,4 +36,4 @@ const Buttons = styled.div<{row?: boolean}>`
}
`;
-export default Buttons;
\ No newline at end of file
+export default Buttons;
diff --git a/src/components/Hero/HeroPrimarySection.tsx b/src/components/Hero/HeroPrimarySection.tsx
index d60be96..d5d8cd2 100644
--- a/src/components/Hero/HeroPrimarySection.tsx
+++ b/src/components/Hero/HeroPrimarySection.tsx
@@ -42,6 +42,6 @@ const HeroPrimarySection: React.FC = ({ header, text, c
)}
{children}
-)
+);
-export default HeroPrimarySection;
\ No newline at end of file
+export default HeroPrimarySection;
diff --git a/src/components/Hero/HeroSecondarySection.tsx b/src/components/Hero/HeroSecondarySection.tsx
index 3c85618..b11e990 100644
--- a/src/components/Hero/HeroSecondarySection.tsx
+++ b/src/components/Hero/HeroSecondarySection.tsx
@@ -24,14 +24,14 @@ interface HeroSecondarySectionItemProps {
note?: string;
}
-export const HeroSecondarySectionItem: React.FC = ({note, children}) => (
+export const HeroSecondarySectionItem: React.FC = ({ note, children }) => (
-
{note}
{children}
-)
+);
const Section = styled.section`
background-color: ${colors.green1};
@@ -59,6 +59,6 @@ const HeroSecondarySection: React.FC = ({ heading, ch
{children}
-)
+);
-export default HeroSecondarySection;
\ No newline at end of file
+export default HeroSecondarySection;
diff --git a/src/components/Hero/index.tsx b/src/components/Hero/index.tsx
index f380770..0ee4b2b 100644
--- a/src/components/Hero/index.tsx
+++ b/src/components/Hero/index.tsx
@@ -3,5 +3,5 @@ export { default as HeroPrimarySection } from "./HeroPrimarySection";
export { default as HeroSecondarySection } from "./HeroSecondarySection";
export { HeroSecondarySectionItem } from "./HeroSecondarySection";
export { default as HeroAside } from "./HeroAside";
-export { HeroAsideItem as HeroAsideItem } from "./HeroAside";
-export { default as HeroPrimaryButtons } from "./HeroPrimaryButtons";
\ No newline at end of file
+export { HeroAsideItem } from "./HeroAside";
+export { default as HeroPrimaryButtons } from "./HeroPrimaryButtons";
diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx
index fc92b95..d5a830b 100644
--- a/src/components/Icon.tsx
+++ b/src/components/Icon.tsx
@@ -18,9 +18,11 @@ interface IconProps {
const nameToIcon = (name: IconType): JSX.Element | string => {
if (name === IconType.Facebook) {
return (
-
+ xmlns="http://www.w3.org/2000/svg"
+ >
Facebook icon
@@ -28,9 +30,11 @@ const nameToIcon = (name: IconType): JSX.Element | string => {
}
if (name === IconType.Instagram) {
return (
-
+ xmlns="http://www.w3.org/2000/svg"
+ >
Instagram icon
@@ -38,9 +42,11 @@ const nameToIcon = (name: IconType): JSX.Element | string => {
}
if (name === IconType.LinkedIn) {
return (
-
+ xmlns="http://www.w3.org/2000/svg"
+ >
LinkedIn icon
@@ -48,7 +54,8 @@ const nameToIcon = (name: IconType): JSX.Element | string => {
}
if (name === IconType.HamburgerMenu) {
return (
-
@@ -84,6 +91,6 @@ const Icon: React.FC = ({ link, name, onClick }) => {
{elem}
);
-}
+};
export default Icon;
diff --git a/src/components/InfoBox.tsx b/src/components/InfoBox.tsx
index 2126318..149d19b 100644
--- a/src/components/InfoBox.tsx
+++ b/src/components/InfoBox.tsx
@@ -10,6 +10,6 @@ const InfoBox: React.FC = ({ children }) => (
{children}
-)
+);
export default InfoBox;
diff --git a/src/components/Link.tsx b/src/components/Link.tsx
index deb09d7..d87430f 100644
--- a/src/components/Link.tsx
+++ b/src/components/Link.tsx
@@ -10,26 +10,30 @@ interface Props extends Omit {
onMouseLeave?: (event: React.MouseEvent) => void;
}
-const Link: React.FC = ({ to, template, passHref, onClick, onMouseEnter, onMouseLeave, ...props }) => {
+const Link: React.FC = ({
+ to, template, passHref, onClick, onMouseEnter, onMouseLeave, ...props
+}) => {
if (template) {
return (
+ {/* eslint-disable-next-line jsx-a11y/anchor-has-content */}
- )
+ );
}
if (to.startsWith("/") || to.startsWith("#")) {
return (
+ {/* eslint-disable-next-line jsx-a11y/anchor-has-content */}
);
}
- else {
- return (
-
- );
- }
-}
+
+ return (
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
+
+ );
+};
export default Link;
diff --git a/src/components/NavbarChildLink.tsx b/src/components/NavbarChildLink.tsx
index bd2dc02..ff894ea 100644
--- a/src/components/NavbarChildLink.tsx
+++ b/src/components/NavbarChildLink.tsx
@@ -29,7 +29,7 @@ const StyledLink = styled(Link)`
`;
const NavbarChildLink: React.FC = (props) => (
-
-)
+
+);
export default NavbarChildLink;
diff --git a/src/components/NavbarDropdownLink.tsx b/src/components/NavbarDropdownLink.tsx
index 4450239..c213ea0 100644
--- a/src/components/NavbarDropdownLink.tsx
+++ b/src/components/NavbarDropdownLink.tsx
@@ -40,7 +40,9 @@ interface NavbarDropdownLinkProps {
exploded?: boolean; // if exploded, show items directly underneath without a dropdown menu
}
-const NavbarDropdownLink: React.FC = ({ to, text, exploded, children }) => {
+const NavbarDropdownLink: React.FC = ({
+ to, text, exploded, children,
+}) => {
const [mouseOverLink, setMouseOverLink] = useState(false);
const [mouseOverBox, setMouseOverBox] = useState(false);
@@ -66,7 +68,7 @@ const NavbarDropdownLink: React.FC = ({ to, text, explo
@@ -81,6 +83,6 @@ const NavbarDropdownLink: React.FC = ({ to, text, explo
);
-}
+};
export default NavbarDropdownLink;
diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx
index a459955..c5bfc2c 100644
--- a/src/components/Navigation.tsx
+++ b/src/components/Navigation.tsx
@@ -6,25 +6,22 @@ import Icon, { IconType } from "./Icon";
import NavbarDropdownLink from "./NavbarDropdownLink";
import NavbarChildLink from "./NavbarChildLink";
-const renderNavigationDesktopItems = () => {
- return (
- <>
-
- Toiminta
- Fuksi
- Kunnianosoitukset
- Arkisto
-
-
-
-
- {/* Simo Höglund */}
-
-
- >
- );
-}
-
+const renderNavigationDesktopItems = () => (
+ <>
+
+ Toiminta
+ Fuksi
+ Kunnianosoitukset
+ Arkisto
+
+
+
+
+ {/* Simo Höglund */}
+
+
+ >
+);
const Nav = styled.div`
flex: 1 0 auto;
@@ -122,6 +119,7 @@ const Navigation: React.FC = ({ onMobileMenuOpen }) => {
- )};
+ );
+};
export default Navigation;
diff --git a/src/components/NavigationMobile.tsx b/src/components/NavigationMobile.tsx
index b8bb9b6..1fa12f1 100644
--- a/src/components/NavigationMobile.tsx
+++ b/src/components/NavigationMobile.tsx
@@ -4,24 +4,22 @@ import { colors } from "@theme/colors";
import NavbarDropdownLink from "./NavbarDropdownLink";
import NavbarChildLink from "./NavbarChildLink";
-const renderNavigationMobileItems = () => {
- return (
- <>
-
- Toiminta
- Fuksi
- Kunnianosoitukset
- Arkisto
-
-
-
-
- {/* Simo Höglund */}
-
-
- >
- );
-}
+const renderNavigationMobileItems = () => (
+ <>
+
+ Toiminta
+ Fuksi
+ Kunnianosoitukset
+ Arkisto
+
+
+
+
+ {/* Simo Höglund */}
+
+
+ >
+);
const Nav = styled.nav`
padding: 1rem 2rem;
@@ -41,6 +39,6 @@ const NavigationMobile: React.FC = ({ mobileMenuOpen }) =
{renderNavigationMobileItems()}
-)
+);
export default NavigationMobile;
diff --git a/src/components/Sections/CTASection.tsx b/src/components/Sections/CTASection.tsx
index e596ad0..8000b80 100644
--- a/src/components/Sections/CTASection.tsx
+++ b/src/components/Sections/CTASection.tsx
@@ -1,4 +1,3 @@
-
import React from "react";
import styled from "styled-components";
import { colors } from "@theme/colors";
@@ -47,8 +46,8 @@ interface CTASectionProps extends React.HTMLAttributes {
}
const textColors = (bgColor: Colors) => {
- switch(bgColor) {
- case "orange1": return `
+ switch (bgColor) {
+ case "orange1": return `
color: ${colors.white};
background-color: ${colors[bgColor]};
a:hover {
@@ -56,12 +55,12 @@ a:hover {
}
`;
- case "darkBlue": return `
+ case "darkBlue": return `
background-color: ${colors[bgColor]};
color: ${colors.white};
`;
- case "lightBlue": return `
+ case "lightBlue": return `
background-color: ${colors[bgColor]};
color: ${colors.darkBlue};
a:hover {
@@ -69,25 +68,27 @@ a:hover {
}
`;
- case "lightTurquoise": return `
+ case "lightTurquoise": return `
background-color: ${colors[bgColor]};
color: ${colors.darkBlue};
a:hover {
color: ${colors.white};
}
`;
- case "blue1": return `
+ case "blue1": return `
background-color: ${colors[bgColor]};
color: ${colors.white};
a:hover {
color: ${colors.darkBlue};
}
`;
- default: return ""
+ default: return "";
}
-}
+};
-const CTASection: React.FC = ({ bgColor = "orange1", link, linkText, children, ...props }) => (
+const CTASection: React.FC = ({
+ bgColor = "orange1", link, linkText, children, ...props
+}) => (
{children}
{link && (
@@ -98,4 +99,4 @@ const CTASection: React.FC = ({ bgColor = "orange1", link, link
);
-export default CTASection;
\ No newline at end of file
+export default CTASection;
diff --git a/src/components/Sections/FullWidthSection.tsx b/src/components/Sections/FullWidthSection.tsx
index b02d56c..165a63e 100644
--- a/src/components/Sections/FullWidthSection.tsx
+++ b/src/components/Sections/FullWidthSection.tsx
@@ -33,6 +33,6 @@ const StyledSection = styled.section`
const FullWidthSection: React.FC> = (props) => (
-)
+);
export default FullWidthSection;
diff --git a/src/components/Sections/TextSection.tsx b/src/components/Sections/TextSection.tsx
index 184d6eb..f73b140 100644
--- a/src/components/Sections/TextSection.tsx
+++ b/src/components/Sections/TextSection.tsx
@@ -84,6 +84,6 @@ const StyledSection = styled.section`
const TextSection: React.FC> = (props) => (
-)
+);
export default TextSection;
diff --git a/src/components/Widgets/Checkbox/Checkbox.tsx b/src/components/Widgets/Checkbox/Checkbox.tsx
index d19589c..c91d209 100644
--- a/src/components/Widgets/Checkbox/Checkbox.tsx
+++ b/src/components/Widgets/Checkbox/Checkbox.tsx
@@ -32,7 +32,7 @@ const CustomCBoxElement = styled.span<{checked?: boolean}>`
left: 0;
height: 1em;
width: 1em;
- background-color: ${(props) => props.checked ? colors.blue1 : colors.grey2};
+ background-color: ${(props) => (props.checked ? colors.blue1 : colors.grey2)};
&:focus &:before {
transition: box-shadow 150ms ease;
@@ -64,7 +64,7 @@ type CheckboxProps = Omit<
"type"
>;
-const Checkbox: React.FC = ({children, checked, ...props}) => (
+const Checkbox: React.FC = ({ children, checked, ...props }) => (
{children}
= ({children, checked, ...props}) => (
{checked && ( )}
-)
+);
-export default Checkbox;
\ No newline at end of file
+export default Checkbox;
diff --git a/src/components/Widgets/Checkbox/Checkboxes.tsx b/src/components/Widgets/Checkbox/Checkboxes.tsx
index d26021d..eadb3ba 100644
--- a/src/components/Widgets/Checkbox/Checkboxes.tsx
+++ b/src/components/Widgets/Checkbox/Checkboxes.tsx
@@ -14,7 +14,7 @@ function selectValue(value, selected, all) {
}
function deselectValue(value, selected) {
- return selected.filter(v => v !== value);
+ return selected.filter((v) => v !== value);
}
type CheckboxesProps = Omit & {
@@ -25,14 +25,16 @@ const CheckboxContainer = styled.div`
margin-bottom: 0.5rem;
`;
-const Checkboxes: React.FC = ({id, disabled, options, value, autofocus, readonly, onChange}) => {
+const Checkboxes: React.FC = ({
+ id, disabled, options, value, autofocus, readonly, onChange,
+}) => {
const { enumOptions, enumDisabled, inline } = options;
return (
{enumOptions.map((option, index) => {
const checked = value.indexOf(option.value) !== -1;
const itemDisabled =
- enumDisabled && enumDisabled.indexOf(option.value) != -1;
+ enumDisabled && enumDisabled.indexOf(option.value) !== -1;
const disabledCls =
disabled || itemDisabled || readonly ? "disabled" : "";
const checkbox = (
@@ -41,8 +43,8 @@ const Checkboxes: React.FC = ({id, disabled, options, value, au
checked={checked}
disabled={disabled || itemDisabled || readonly}
autoFocus={autofocus && index === 0}
- onChange={event => {
- const all = enumOptions.map(({ value }) => value);
+ onChange={(event) => {
+ const all = enumOptions.map(({ val }) => val);
if (event.target.checked) {
onChange(selectValue(option.value, value, all));
} else {
@@ -64,15 +66,14 @@ const Checkboxes: React.FC = ({id, disabled, options, value, au
);
})}
- )
-}
+ );
+};
Checkboxes.defaultProps = {
autofocus: false,
options: {
inline: false,
- }
-}
+ },
+};
-
-export default Checkboxes;
\ No newline at end of file
+export default Checkboxes;
diff --git a/src/components/Widgets/DatetimeWidget.tsx b/src/components/Widgets/DatetimeWidget.tsx
index 7bfb2a6..ecf9a2a 100644
--- a/src/components/Widgets/DatetimeWidget.tsx
+++ b/src/components/Widgets/DatetimeWidget.tsx
@@ -22,7 +22,9 @@ interface DatetimeWidgetProps {
disabled: boolean;
}
-const DatetimeWidget: React.FC = ({ value, onChange, onFocus, onBlur, required, disabled }) => {
+const DatetimeWidget: React.FC = ({
+ value, onChange, onFocus, onBlur, required, disabled,
+}) => {
let date;
let time;
if (value && value.length !== 0) {
@@ -44,14 +46,16 @@ const DatetimeWidget: React.FC = ({ value, onChange, onFocu
type="date"
onChange={(event) => onChange(`${event.target.value}T${time}`)}
value={date}
- {...commonProps} />
+ {...commonProps}
+ />
onChange(`${date}T${event.target.value}:00`)}
value={time}
- {...commonProps} />
+ {...commonProps}
+ />
);
-}
+};
export default DatetimeWidget;
diff --git a/src/components/Widgets/MarkdownEditorWidget.tsx b/src/components/Widgets/MarkdownEditorWidget.tsx
index 9790a87..1b843c6 100644
--- a/src/components/Widgets/MarkdownEditorWidget.tsx
+++ b/src/components/Widgets/MarkdownEditorWidget.tsx
@@ -32,12 +32,10 @@ const MarkdownEditorWidget: React.FC = ({ value, onCh
onChange={onChange}
selectedTab={selectedTab}
onTabChange={setSelectedTab}
- generateMarkdownPreview={markdown =>
- Promise.resolve( )
- }
+ generateMarkdownPreview={(markdown) => Promise.resolve( )}
/>
- )
-}
+ );
+};
export default MarkdownEditorWidget;
diff --git a/src/components/Widgets/RadioButton/RadioButton.tsx b/src/components/Widgets/RadioButton/RadioButton.tsx
index 2f9bc27..48bd9b8 100644
--- a/src/components/Widgets/RadioButton/RadioButton.tsx
+++ b/src/components/Widgets/RadioButton/RadioButton.tsx
@@ -28,7 +28,7 @@ const CustomRadioElement = styled.span<{checked?: boolean}>`
left: 0;
height: 1em;
width: 1em;
- background-color: ${(props) => props.checked ? "#57b2df" : "#efece4"}; /* blue1 or grey2 */
+ background-color: ${(props) => (props.checked ? "#57b2df" : "#efece4")}; /* blue1 or grey2 */
border-radius: 50%;
`;
diff --git a/src/components/Widgets/RadioButton/RadioButtonWidget.tsx b/src/components/Widgets/RadioButton/RadioButtonWidget.tsx
index 920059e..b9e7a95 100644
--- a/src/components/Widgets/RadioButton/RadioButtonWidget.tsx
+++ b/src/components/Widgets/RadioButton/RadioButtonWidget.tsx
@@ -34,7 +34,7 @@ const RadioButtonWidget: React.FC = (props) => {
{enumOptions.map((option, i) => {
const checked = option.value === value;
const itemDisabled =
- enumDisabled && enumDisabled.indexOf(option.value) != -1;
+ enumDisabled && enumDisabled.indexOf(option.value) !== -1;
const disabledCls =
disabled || itemDisabled || readonly ? "disabled" : "";
const radio = (
@@ -46,8 +46,8 @@ const RadioButtonWidget: React.FC = (props) => {
disabled={disabled || itemDisabled || readonly}
autoFocus={autofocus && i === 0}
onChange={() => onChange(option.value)}
- onBlur={onBlur && (event => onBlur(id, event.target.value))}
- onFocus={onFocus && (event => onFocus(id, event.target.value))}
+ onBlur={onBlur && ((event) => onBlur(id, event.target.value))}
+ onFocus={onFocus && ((event) => onFocus(id, event.target.value))}
>
{option.label}
@@ -65,10 +65,10 @@ const RadioButtonWidget: React.FC = (props) => {
})}
);
-}
+};
RadioButtonWidget.defaultProps = {
autofocus: false,
};
-export default RadioButtonWidget;
\ No newline at end of file
+export default RadioButtonWidget;
diff --git a/src/components/Widgets/SectionDividerWidget.tsx b/src/components/Widgets/SectionDividerWidget.tsx
index 47bb4f8..4892c25 100644
--- a/src/components/Widgets/SectionDividerWidget.tsx
+++ b/src/components/Widgets/SectionDividerWidget.tsx
@@ -8,14 +8,14 @@ interface SectionDividerWidgetProps {
const getIconByLabel = (label: string) => {
if (label === "Finnish") {
- return
+ return ;
}
if (label === "English") {
- return
+ return ;
}
console.error(`No icon found for label: ${label}`);
return null;
-}
+};
const Heading = styled.h3`
display: flex;
diff --git a/src/components/Widgets/SignupQuestionsWidget/OptionsWidget.tsx b/src/components/Widgets/SignupQuestionsWidget/OptionsWidget.tsx
index 623311a..50fcaee 100644
--- a/src/components/Widgets/SignupQuestionsWidget/OptionsWidget.tsx
+++ b/src/components/Widgets/SignupQuestionsWidget/OptionsWidget.tsx
@@ -1,18 +1,20 @@
import React from "react";
-import { Question, InputProps, optionTypes, SignupQuestionError } from "./index";
+import {
+ Question, InputProps, optionTypes, SignupQuestionError,
+} from "./index";
import Checkbox from "@components/Widgets/Checkbox/Checkbox";
-export interface OptionsWidgetProps {
+interface OptionsWidgetProps {
inputProps: InputProps;
onChange: (value: Question[]) => void;
}
-export interface OptionsWidgetState { }
-class OptionsWidget extends React.Component {
+class OptionsWidget extends React.Component {
handleListOptionsChange = (questions: Question[], index: number) => (event) => {
const { onChange } = this.props;
const val = event.target.value;
- const lst = val.split(",").map(p => p.trimLeft());
+ const lst = val.split(",").map((p) => p.trimLeft());
+ // eslint-disable-next-line no-param-reassign
questions[index].options = lst;
onChange(questions);
}
@@ -20,6 +22,7 @@ class OptionsWidget extends React.Component (event) => {
const { onChange } = this.props;
const val = event.target.value;
+ // eslint-disable-next-line no-param-reassign
questions[index].options = val;
onChange(questions);
}
@@ -28,11 +31,13 @@ class OptionsWidget extends React.Component p.trimLeft());
+ const lst = val.split(",").map((p) => p.trimLeft());
// Ignore everything else but the two first values
+ // eslint-disable-next-line no-param-reassign
questions[index].options = lst.splice(0, 2);
} else {
- questions[index].options = []
+ // eslint-disable-next-line no-param-reassign
+ questions[index].options = [];
}
onChange(questions);
@@ -42,6 +47,7 @@ class OptionsWidget extends React.ComponentRequired?;
+ return (
+ Required?
+
+ );
}
render() {
const { inputProps } = this.props;
- const { type, value, questions, index } = inputProps;
+ const {
+ type, value, questions, index,
+ } = inputProps;
if (!optionTypes.includes(type)) {
throw new SignupQuestionError(`Question widget type "${type}" not in types array.`);
}
@@ -73,7 +84,8 @@ class OptionsWidget extends React.Component
+ onChange={this.handleTextOptionsChange(questions, index)}
+ />
{this.requiredField()}
>
);
@@ -88,9 +100,11 @@ class OptionsWidget extends React.Component
+ onChange={this.handleIntegerOptionsChange(questions, index)}
+ />
{this.requiredField()}
- >);
+ >
+ );
}
if (type === "radiobutton") {
@@ -102,9 +116,11 @@ class OptionsWidget extends React.Component
+ onChange={this.handleListOptionsChange(questions, index)}
+ />
{this.requiredField()}
- >);
+ >
+ );
}
if (type === "checkbox") {
@@ -116,9 +132,11 @@ class OptionsWidget extends React.Component
+ onChange={this.handleListOptionsChange(questions, index)}
+ />
{this.requiredField()}
- >);
+ >
+ );
}
throw new SignupQuestionError(`Unrecognized question widget type "${type}"`);
diff --git a/src/components/Widgets/SignupQuestionsWidget/QuestionList.tsx b/src/components/Widgets/SignupQuestionsWidget/QuestionList.tsx
index 2229f99..4640116 100644
--- a/src/components/Widgets/SignupQuestionsWidget/QuestionList.tsx
+++ b/src/components/Widgets/SignupQuestionsWidget/QuestionList.tsx
@@ -15,15 +15,14 @@ const WidgetRow = styled.div`
background-color: ${colors.lightBlue};
`;
-export interface QuestionListProps {
+interface QuestionListProps {
questions: Question[];
innerRef: any;
placeholder: any;
onChange: (value: Question[]) => void;
}
-export interface QuestionListState { }
-class QuestionList extends React.Component {
+class QuestionList extends React.Component {
renderTextWidget = ({ questions, value, index }: InputProps) => (
)
@@ -31,6 +30,7 @@ class QuestionList extends React.Component
handleNameInputChange = (questions: Question[], index: number) => (event) => {
const { onChange } = this.props;
const val = event.target.value;
+ // eslint-disable-next-line no-param-reassign
questions[index].name = val;
onChange(questions);
}
@@ -45,10 +45,14 @@ class QuestionList extends React.Component
renderQuestions() {
const { questions, onChange, placeholder } = this.props;
return questions.map((q, index) => {
- const nameWidgetProps = { value: q.name, type: "text", questions, index };
+ const nameWidgetProps = {
+ value: q.name, type: "text", questions, index,
+ };
const nameWidget = this.renderTextWidget(nameWidgetProps);
- const dataProps = { value: q.options, type: q.type, questions, index };
+ const dataProps = {
+ value: q.options, type: q.type, questions, index,
+ };
const optionsWidget = ;
const typeSelectWidget = ;
return (
diff --git a/src/components/Widgets/SignupQuestionsWidget/SignupQuestionsWidget.tsx b/src/components/Widgets/SignupQuestionsWidget/SignupQuestionsWidget.tsx
index 6269da3..bc87bd3 100644
--- a/src/components/Widgets/SignupQuestionsWidget/SignupQuestionsWidget.tsx
+++ b/src/components/Widgets/SignupQuestionsWidget/SignupQuestionsWidget.tsx
@@ -2,7 +2,7 @@ import React from "react";
import styled from "styled-components";
import shortid from "shortid";
import { DragDropContext, Droppable } from "react-beautiful-dnd";
-import { Question } from "."
+import { Question } from ".";
import colors from "@theme/colors";
import QuestionList from "./QuestionList";
@@ -46,7 +46,7 @@ const SignupQuestionsWidget: React.FC = ({ value, on
const onValueChange = (questions: Question[]) => {
const newValue = JSON.stringify(questions);
onChange(newValue);
- }
+ };
const handleNewRowClick = (questions) => () => {
const newRow: Question = {
@@ -58,7 +58,7 @@ const SignupQuestionsWidget: React.FC = ({ value, on
const newQuestions: Question[] = questions.concat([newRow]);
onValueChange(newQuestions);
- }
+ };
const handleDragEnd = (questions: Question[]) => (result) => {
const srcIndex = result.source.index;
@@ -68,7 +68,7 @@ const SignupQuestionsWidget: React.FC = ({ value, on
questions.splice(dstIndex, 0, srcCopy);
onValueChange(questions);
- }
+ };
const questions = JSON.parse(value) as Question[];
return (
@@ -84,7 +84,8 @@ const SignupQuestionsWidget: React.FC = ({ value, on
innerRef={provided.innerRef}
questions={questions}
onChange={onValueChange}
- placeholder={provided.placeholder} />
+ placeholder={provided.placeholder}
+ />
)}
@@ -94,6 +95,6 @@ const SignupQuestionsWidget: React.FC = ({ value, on
);
-}
+};
export default SignupQuestionsWidget;
diff --git a/src/components/Widgets/SignupQuestionsWidget/TypeWidget.tsx b/src/components/Widgets/SignupQuestionsWidget/TypeWidget.tsx
index bea9a88..bba9aee 100644
--- a/src/components/Widgets/SignupQuestionsWidget/TypeWidget.tsx
+++ b/src/components/Widgets/SignupQuestionsWidget/TypeWidget.tsx
@@ -1,16 +1,16 @@
import React from "react";
import { Question, InputProps, optionTypes } from "./index";
-export interface TypeWidgetProps {
+interface TypeWidgetProps {
inputProps: InputProps;
onChange: (value: Question[]) => void;
}
-export interface TypeWidgetState { }
-class TypeWidget extends React.Component {
+class TypeWidget extends React.Component {
handleTypeChange = (questions: Question[], index: number) => (event) => {
const { onChange } = this.props;
const val = event.target.value;
+ // eslint-disable-next-line no-param-reassign
questions[index].type = val;
onChange(questions);
}
@@ -18,7 +18,7 @@ class TypeWidget extends React.Component {
render() {
const { inputProps } = this.props;
const { type, questions, index } = inputProps;
- const options = optionTypes.map(t => (
+ const options = optionTypes.map((t) => (
{t}
));
return (
diff --git a/src/components/Widgets/SignupQuestionsWidget/index.ts b/src/components/Widgets/SignupQuestionsWidget/index.ts
index daa90fc..87d807f 100644
--- a/src/components/Widgets/SignupQuestionsWidget/index.ts
+++ b/src/components/Widgets/SignupQuestionsWidget/index.ts
@@ -31,7 +31,7 @@ export const optionTypes = [
"radiobutton",
"checkbox",
"email",
- "name"
+ "name",
];
export class SignupQuestionError extends Error { }
diff --git a/src/models/Event.ts b/src/models/Event.ts
index 65e2760..7476b3d 100644
--- a/src/models/Event.ts
+++ b/src/models/Event.ts
@@ -39,11 +39,11 @@ export async function getEvents(options: Options = {}): Promise {
limit,
};
const search = qs.stringify(params);
- const headers = auth ? { "Authorization": getAuthHeader() } : null;
+ const headers = auth ? { Authorization: getAuthHeader() } : null;
const resp = await axios.get(`${URL}?${search}`, {
- headers
+ headers,
});
- return resp.data["results"];
+ return resp.data.results;
} catch (err) {
console.error(err);
throw err;
@@ -52,9 +52,9 @@ export async function getEvents(options: Options = {}): Promise {
export async function getEvent(id: number, auth = false): Promise {
try {
- const headers = auth ? { "Authorization": getAuthHeader() } : null;
+ const headers = auth ? { Authorization: getAuthHeader() } : null;
const resp = await axios.get(`${URL}${id}/`, {
- headers
+ headers,
});
return resp.data;
} catch (err) {
@@ -67,7 +67,7 @@ export async function createEvent(data): Promise {
try {
const resp = await axios.post(URL, data, {
headers: {
- "Authorization": getAuthHeader(),
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -82,7 +82,7 @@ export async function updateEvent(data): Promise {
const putUrl = `${URL}${data.id}/`;
const resp = await axios.put(putUrl, data, {
headers: {
- "Authorization": getAuthHeader(),
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -96,7 +96,7 @@ export async function deleteEvent(id: number) {
try {
const resp = await axios.delete(`${URL}${id}`, {
headers: {
- "Authorization": getAuthHeader()
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -106,7 +106,7 @@ export async function deleteEvent(id: number) {
}
}
-export const eventFetcher = (url: string, config?: AxiosRequestConfig) => axios.get(url, config).then(res => res.data);
+export const eventFetcher = (url: string, config?: AxiosRequestConfig) => axios.get(url, config).then((res) => res.data);
export const generateFetchParams = (id = "", options: Options = {}) => {
const url = `${URL}${id}`;
@@ -117,12 +117,12 @@ export const generateFetchParams = (id = "", options: Options = {}) => {
config: {
params: {
since: onlyNonPast ? (new Date()).toISOString() : undefined,
- limit
+ limit,
},
- headers: auth ? { "Authorization": getAuthHeader() } : null
- }
- }
-}
+ headers: auth ? { Authorization: getAuthHeader() } : null,
+ },
+ };
+};
interface FetchArguments {
initialData?: Event | Event[],
@@ -133,12 +133,12 @@ interface FetchArguments {
export const useFetchEvents = ({
initialData,
id = "",
- options = {}
+ options = {},
}: FetchArguments) => {
const { url, config } = generateFetchParams(id, options);
const { data, error } = useSWR([url, config], eventFetcher, { initialData });
return {
data: data?.results || data,
- error
- }
-}
+ error,
+ };
+};
diff --git a/src/models/Feed.ts b/src/models/Feed.ts
index 3b3299c..6da243f 100644
--- a/src/models/Feed.ts
+++ b/src/models/Feed.ts
@@ -27,10 +27,10 @@ interface Options {
export async function getFeed(options: Options = {}): Promise {
const { auth } = options;
- const headers = auth ? { "Authorization": getAuthHeader() } : null;
+ const headers = auth ? { Authorization: getAuthHeader() } : null;
try {
const resp = await axios.get(URL, { headers });
- return resp.data["results"];
+ return resp.data.results;
} catch (err) {
console.error(err);
throw err;
@@ -39,7 +39,7 @@ export async function getFeed(options: Options = {}): Promise {
export async function getPost(id: number, options: Options = {}): Promise {
const { auth } = options;
- const headers = auth ? { "Authorization": getAuthHeader() } : null;
+ const headers = auth ? { Authorization: getAuthHeader() } : null;
try {
const resp = await axios.get(`${URL}${id}/`, { headers });
return resp.data;
@@ -53,7 +53,7 @@ export async function createPost(data): Promise {
try {
const resp = await axios.post(URL, data, {
headers: {
- "Authorization": getAuthHeader(),
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -68,7 +68,7 @@ export async function updatePost(data): Promise {
const putUrl = `${URL}${data.id}/`;
const resp = await axios.put(putUrl, data, {
headers: {
- "Authorization": getAuthHeader(),
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -78,7 +78,7 @@ export async function updatePost(data): Promise {
}
}
-export const feedFetcher = (url: string, config?: AxiosRequestConfig) => axios.get(url, config).then(res => res.data);
+export const feedFetcher = (url: string, config?: AxiosRequestConfig) => axios.get(url, config).then((res) => res.data);
export const generateFetchParams = (id = "", options: Options = {}) => {
const url = `${URL}${id}`;
@@ -87,10 +87,10 @@ export const generateFetchParams = (id = "", options: Options = {}) => {
return {
url,
config: {
- headers: auth ? { "Authorization": getAuthHeader() } : null
- }
- }
-}
+ headers: auth ? { Authorization: getAuthHeader() } : null,
+ },
+ };
+};
interface FetchArguments {
initialData?: Post | Post[],
@@ -101,12 +101,12 @@ interface FetchArguments {
export const useFetchFeed = ({
initialData,
id = "",
- options = {}
+ options = {},
}: FetchArguments) => {
const { url, config } = generateFetchParams(id, options);
const { data, error } = useSWR([url, config], feedFetcher, { initialData });
return {
data: data?.results || data,
- error
- }
-}
+ error,
+ };
+};
diff --git a/src/models/JobAd.ts b/src/models/JobAd.ts
index 5a14991..39ada99 100644
--- a/src/models/JobAd.ts
+++ b/src/models/JobAd.ts
@@ -31,35 +31,35 @@ export const getJobAds = async (options: GetJobAdsOptions = {}): Promise => {
+export const getJobAd = async (id: number, auth = false): Promise => {
try {
- const headers = auth ? { "Authorization": getAuthHeader() } : null;
+ const headers = auth ? { Authorization: getAuthHeader() } : null;
const resp = await axios.get(`${URL}${id}/`, {
- headers
+ headers,
});
return resp.data;
} catch (err) {
console.error(err);
throw err;
}
-}
+};
export const createJobAd = async (data: any): Promise => {
try {
const resp = await axios.post(URL, data, {
headers: {
- "Authorization": getAuthHeader(),
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -67,14 +67,14 @@ export const createJobAd = async (data: any): Promise => {
console.error(err);
throw err;
}
-}
+};
export const updateJobAd = async (data: any): Promise => {
try {
const putUrl = `${URL}${data.id}/`;
const resp = await axios.put(putUrl, data, {
headers: {
- "Authorization": getAuthHeader(),
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -82,9 +82,9 @@ export const updateJobAd = async (data: any): Promise => {
console.error(err);
throw err;
}
-}
+};
-export const jobAdFetcher = (url: string, config?: AxiosRequestConfig) => axios.get(url, config).then(res => res.data);
+export const jobAdFetcher = (url: string, config?: AxiosRequestConfig) => axios.get(url, config).then((res) => res.data);
export const generateFetchParams = (id = "", options: Options = {}) => {
const url = `${URL}${id}`;
@@ -93,10 +93,10 @@ export const generateFetchParams = (id = "", options: Options = {}) => {
return {
url,
config: {
- headers: auth ? { "Authorization": getAuthHeader() } : null
- }
- }
-}
+ headers: auth ? { Authorization: getAuthHeader() } : null,
+ },
+ };
+};
interface Options {
auth?: boolean;
@@ -111,12 +111,12 @@ interface FetchArguments {
export const useFetchJobAds = ({
initialData,
id = "",
- options = {}
+ options = {},
}: FetchArguments) => {
const { url, config } = generateFetchParams(id, options);
const { data, error } = useSWR([url, config], jobAdFetcher, { initialData });
return {
data: data?.results || data,
- error
- }
-}
\ No newline at end of file
+ error,
+ };
+};
diff --git a/src/models/Signup.ts b/src/models/Signup.ts
index 0923321..7c4626c 100644
--- a/src/models/Signup.ts
+++ b/src/models/Signup.ts
@@ -1,5 +1,6 @@
import axios from "axios";
import { getAuthHeader } from "@utils/auth";
+
const url = `${process.env.NEXT_PUBLIC_API_URL}/signup/`;
export interface Signup {
@@ -12,7 +13,7 @@ export const getSignup = async (id: number): Promise => {
try {
const resp = await axios.get(`${url}${id}`, {
headers: {
- "Authorization": getAuthHeader()
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -20,7 +21,7 @@ export const getSignup = async (id: number): Promise => {
console.error(err);
throw err;
}
-}
+};
export const createSignup = async (data: Signup): Promise => {
try {
@@ -30,41 +31,27 @@ export const createSignup = async (data: Signup): Promise => {
console.error(err);
throw err;
}
-}
+};
export const updateSignup = async (data: Signup, uuid: string): Promise => {
try {
const { id } = data;
if (!id) throw new Error("SignupId required!");
const resp = await axios.put(`${url}${id}/edit/`, data, {
- params: { uuid }
+ params: { uuid },
});
return resp.data;
} catch (err) {
console.error(err);
throw err;
}
-}
+};
export const getSignupUUID = async (id: number, uuid: string): Promise => {
try {
const resp = await axios.get(`${url}${id}/edit/`, {
params: {
- uuid
- }
- });
- return resp.data;
- } catch (err) {
- console.error(err);
- throw err;
- }
-}
-
-export const deleteSignup = async (id: number) => {
- try {
- const resp = await axios.delete(`${url}${id}`, {
- headers: {
- "Authorization": getAuthHeader()
+ uuid,
},
});
return resp.data;
@@ -72,4 +59,18 @@ export const deleteSignup = async (id: number) => {
console.error(err);
throw err;
}
-}
+};
+
+export const deleteSignup = async (id: number) => {
+ try {
+ const resp = await axios.delete(`${url}${id}`, {
+ headers: {
+ Authorization: getAuthHeader(),
+ },
+ });
+ return resp.data;
+ } catch (err) {
+ console.error(err);
+ throw err;
+ }
+};
diff --git a/src/models/SignupForm.ts b/src/models/SignupForm.ts
index 5520118..b3f4c07 100644
--- a/src/models/SignupForm.ts
+++ b/src/models/SignupForm.ts
@@ -26,9 +26,9 @@ export interface SignupForm {
export async function getForms(auth = false): Promise {
try {
- const headers = auth ? { "Authorization": getAuthHeader() } : null;
+ const headers = auth ? { Authorization: getAuthHeader() } : null;
const resp = await axios.get(URL, {
- headers
+ headers,
});
const { results } = resp.data;
return results;
@@ -40,9 +40,9 @@ export async function getForms(auth = false): Promise {
export async function getForm(id: number, auth = false): Promise {
try {
- const headers = auth ? { "Authorization": getAuthHeader() } : null;
+ const headers = auth ? { Authorization: getAuthHeader() } : null;
const resp = await axios.get(`${URL}${id}/`, {
- headers
+ headers,
});
return resp.data;
} catch (err) {
@@ -55,7 +55,7 @@ export async function createForm(data): Promise {
try {
const resp = await axios.post(URL, data, {
headers: {
- "Authorization": getAuthHeader(),
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -70,7 +70,7 @@ export async function updateForm(data): Promise {
const putUrl = `${URL}${data.id}/`;
const resp = await axios.put(putUrl, data, {
headers: {
- "Authorization": getAuthHeader(),
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -84,7 +84,7 @@ export async function deleteForm(id: number) {
try {
const resp = await axios.delete(`${URL}${id}`, {
headers: {
- "Authorization": getAuthHeader()
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -98,7 +98,7 @@ export const signupFormSendEmail = async (data, id): Promise => {
try {
const resp = await axios.post(`${URL}${id}/sendemail/`, data, {
headers: {
- "Authorization": getAuthHeader(),
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -106,13 +106,13 @@ export const signupFormSendEmail = async (data, id): Promise => {
console.error(err);
throw err;
}
-}
+};
export const getSignups = async (id): Promise => {
try {
const resp = await axios.get(`${URL}${id}/signups/`, {
headers: {
- "Authorization": getAuthHeader(),
+ Authorization: getAuthHeader(),
},
});
return resp.data;
@@ -120,4 +120,4 @@ export const getSignups = async (id): Promise => {
console.error(err);
throw err;
}
-}
+};
diff --git a/src/models/Tag.ts b/src/models/Tag.ts
index f1677f3..6a4ef37 100644
--- a/src/models/Tag.ts
+++ b/src/models/Tag.ts
@@ -13,7 +13,7 @@ export interface Tag {
export async function getTags(): Promise {
try {
const resp = await axios.get(url);
- return resp.data["results"];
+ return resp.data.results;
} catch (err) {
console.error(err);
throw err;
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index d535ebd..f15a965 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -1,6 +1,6 @@
import React from "react";
// import App from "next/app";
-import type { AppProps /*, AppContext'*/} from "next/app"
+import type { AppProps /* , AppContext' */ } from "next/app";
import Head from "next/head";
import styled, { createGlobalStyle } from "styled-components";
import { colors } from "@theme/colors";
@@ -123,29 +123,27 @@ const AppContainer = styled.div`
background-color: ${colors.white};
`;
-const Web20App = ({ Component, pageProps }: AppProps) => {
- return (
- <>
-
-
-
- {/* */}
- {/* */}
-
- {/* */}
- {/* */}
- {/* SIK100 */}
- {/* */}
- {/* */}
- {/* */}
-
-
-
-
-
- >
- )
-}
+const Web20App = ({ Component, pageProps }: AppProps) => (
+ <>
+
+
+
+ {/* */}
+ {/* */}
+
+ {/* */}
+ {/* */}
+ {/* SIK100 */}
+ {/* */}
+ {/* */}
+ {/* */}
+
+
+
+
+
+ >
+);
// Only uncomment this method if you have blocking data requirements for
// every single page in your application. This disables the ability to
diff --git a/src/pages/admin/events/[id].tsx b/src/pages/admin/events/[id].tsx
index 1cff9ad..1c542e9 100644
--- a/src/pages/admin/events/[id].tsx
+++ b/src/pages/admin/events/[id].tsx
@@ -5,7 +5,9 @@ import { useRouter } from "next/router";
import AdminCreateCommon from "@views/admin/AdminCreateCommon";
import { Tag, getTags } from "@models/Tag";
import { SignupForm, getForms } from "@models/SignupForm";
-import { Event, createEvent, getEvent, updateEvent } from "@models/Event";
+import {
+ Event, createEvent, getEvent, updateEvent,
+} from "@models/Event";
import DatetimeWidget from "@components/Widgets/DatetimeWidget";
import SectionDividerWidget from "@components/Widgets/SectionDividerWidget";
import MarkdownEditorWidget from "@components/Widgets/MarkdownEditorWidget";
@@ -13,11 +15,12 @@ import MarkdownEditorWidget from "@components/Widgets/MarkdownEditorWidget";
const widgets = {
datetime: DatetimeWidget,
section_divider: SectionDividerWidget,
- markdownEditor: MarkdownEditorWidget
+ markdownEditor: MarkdownEditorWidget,
};
const buildSchema = (formData: Event, signupForms: SignupForm[], tags: Tag[]) => {
- const date = new Date(), tomorrowDate = new Date();
+ const date = new Date(); const
+ tomorrowDate = new Date();
const currentDatetime = date.toISOString();
tomorrowDate.setDate(tomorrowDate.getDate() + 1);
const tomorrowDatetime = tomorrowDate.toISOString();
@@ -32,8 +35,8 @@ const buildSchema = (formData: Event, signupForms: SignupForm[], tags: Tag[]) =>
title: "Event tags",
items: {
type: "number",
- enum: tags.map(t => t.id),
- enumNames: tags.map(t => t.name_fi),
+ enum: tags.map((t) => t.id),
+ enumNames: tags.map((t) => t.name_fi),
},
uniqueItems: true,
default: [],
@@ -59,8 +62,8 @@ const buildSchema = (formData: Event, signupForms: SignupForm[], tags: Tag[]) =>
items: {
type: "number",
// TODO: A bug here, DB must have at least one SignupForm, otherwise cannot submit
- enum: signupForms.map(form => form.id),
- enumNames: signupForms.map(form => form.title_fi),
+ enum: signupForms.map((form) => form.id),
+ enumNames: signupForms.map((form) => form.title_fi),
},
uniqueItems: true,
},
@@ -68,7 +71,7 @@ const buildSchema = (formData: Event, signupForms: SignupForm[], tags: Tag[]) =>
type: ["string", "null"],
format: formData?.image ? "uri-reference" : "data-url",
title: "Override tag icon with image",
- default: undefined
+ default: undefined,
},
finnish_section_divider: {
title: "Finnish",
@@ -77,7 +80,7 @@ const buildSchema = (formData: Event, signupForms: SignupForm[], tags: Tag[]) =>
title_fi: {
type: "string",
title: "Title",
- default: ""
+ default: "",
},
description_fi: {
type: "string",
@@ -101,7 +104,7 @@ const buildSchema = (formData: Event, signupForms: SignupForm[], tags: Tag[]) =>
title_en: {
type: "string",
title: "Title",
- default: ""
+ default: "",
},
description_en: {
type: "string",
@@ -118,10 +121,10 @@ const buildSchema = (formData: Event, signupForms: SignupForm[], tags: Tag[]) =>
title: "Location",
default: "",
},
- }
+ },
};
return schema;
-}
+};
const buildUISchema = () => {
const uiSchema = {
@@ -139,24 +142,24 @@ const buildUISchema = () => {
},
image: {
"ui:options": {
- accept: [".jpg", ".jpeg", ".png"]
- }
+ accept: [".jpg", ".jpeg", ".png"],
+ },
},
finnish_section_divider: {
"ui:widget": "section_divider",
"ui:options": {
- label: false
+ label: false,
},
},
english_section_divider: {
"ui:widget": "section_divider",
"ui:options": {
- label: false
+ label: false,
},
},
};
return uiSchema;
-}
+};
const EventCreatePage: NextPage = () => {
const [formData, setFormData] = useState(null);
@@ -174,26 +177,25 @@ const EventCreatePage: NextPage = () => {
}
useEffect(() => {
-
getTags()
- .then(res => setTags(res))
- .catch(err => setError(err))
+ .then((res) => setTags(res))
+ .catch((err) => setError(err));
getForms(true)
- .then(res => setSignupForms(res))
- .catch(err => setError(err))
+ .then((res) => setSignupForms(res))
+ .catch((err) => setError(err));
const eventId = id && Number(id);
if (eventId !== undefined) {
getEvent(eventId, true)
- .then(res => setFormData({
+ .then((res) => setFormData({
...res,
- tags: (res.tags).map(inst => inst.id) as any,
- signupForm: (res.signupForm).map(inst => inst.id) as any,
+ tags: (res.tags).map((inst) => inst.id) as any,
+ signupForm: (res.signupForm).map((inst) => inst.id) as any,
}))
- .catch(err => setError(err))
+ .catch((err) => setError(err));
}
- }, [id])
+ }, [id]);
const onSubmit = async (data) => {
try {
@@ -226,7 +228,7 @@ const EventCreatePage: NextPage = () => {
} catch (err) {
setError(err);
}
- }
+ };
const onChange = (data) => setFormData(data.formData);
const onFocus = () => setStatusMessage(null);
@@ -253,7 +255,7 @@ const EventCreatePage: NextPage = () => {
/>
>
);
-}
+};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
diff --git a/src/pages/admin/events/index.tsx b/src/pages/admin/events/index.tsx
index 5aba286..8c4a793 100644
--- a/src/pages/admin/events/index.tsx
+++ b/src/pages/admin/events/index.tsx
@@ -7,7 +7,7 @@ import { Link } from "@components/index";
import AddLink from "@components/AddLink";
import { Event, getEvents } from "@models/Event";
-const URL = "/admin/events"
+const URL = "/admin/events";
const renderData = (events: Event[]) => {
if (!events || events.length === 0) {
@@ -24,7 +24,7 @@ const renderData = (events: Event[]) => {
- {events.map(event => (
+ {events.map((event) => (
{event.title_fi}
{formatRelative(new Date(event.start_time), new Date())}
@@ -34,13 +34,13 @@ const renderData = (events: Event[]) => {
);
-}
-const AdminEventPage: NextPage= () => {
+};
+const AdminEventPage: NextPage = () => {
const [events, setEvents] = useState(null);
useEffect(() => {
getEvents({ auth: true })
- .then(res => setEvents(res))
+ .then((res) => setEvents(res));
}, []);
return (
@@ -55,7 +55,7 @@ const AdminEventPage: NextPage= () => {
>
);
-}
+};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
diff --git a/src/pages/admin/feed/[id].tsx b/src/pages/admin/feed/[id].tsx
index 4f6d24c..4efdddb 100644
--- a/src/pages/admin/feed/[id].tsx
+++ b/src/pages/admin/feed/[id].tsx
@@ -4,7 +4,9 @@ import Head from "next/head";
import { useRouter } from "next/router";
import AdminCreateCommon from "@views/admin/AdminCreateCommon";
import { Tag, getTags } from "@models/Tag";
-import { Post, createPost, getPost, updatePost } from "@models/Feed";
+import {
+ Post, createPost, getPost, updatePost,
+} from "@models/Feed";
import DatetimeWidget from "@components/Widgets/DatetimeWidget";
import SectionDividerWidget from "@components/Widgets/SectionDividerWidget";
import MarkdownEditorWidget from "@components/Widgets/MarkdownEditorWidget";
@@ -12,7 +14,7 @@ import MarkdownEditorWidget from "@components/Widgets/MarkdownEditorWidget";
const widgets = {
datetime: DatetimeWidget,
section_divider: SectionDividerWidget,
- markdownEditor: MarkdownEditorWidget
+ markdownEditor: MarkdownEditorWidget,
};
const buildSchema = (formData: Post, tags: Tag[]) => {
@@ -29,8 +31,8 @@ const buildSchema = (formData: Post, tags: Tag[]) => {
title: "Post tags",
items: {
type: "number",
- enum: tags.map(t => t.id),
- enumNames: tags.map(t => t.name_fi),
+ enum: tags.map((t) => t.id),
+ enumNames: tags.map((t) => t.name_fi),
},
uniqueItems: true,
default: [],
@@ -62,7 +64,7 @@ const buildSchema = (formData: Post, tags: Tag[]) => {
title_fi: {
type: "string",
title: "Title",
- default: ""
+ default: "",
},
description_fi: {
type: "string",
@@ -81,7 +83,7 @@ const buildSchema = (formData: Post, tags: Tag[]) => {
title_en: {
type: "string",
title: "Title",
- default: ""
+ default: "",
},
description_en: {
type: "string",
@@ -93,10 +95,10 @@ const buildSchema = (formData: Post, tags: Tag[]) => {
title: "Content",
default: "",
},
- }
+ },
};
return schema;
-}
+};
const buildUISchema = (formData: Post) => {
const uiSchema = {
@@ -115,18 +117,18 @@ const buildUISchema = (formData: Post) => {
finnish_section_divider: {
"ui:widget": "section_divider",
"ui:options": {
- label: false
+ label: false,
},
},
english_section_divider: {
"ui:widget": "section_divider",
"ui:options": {
- label: false
+ label: false,
},
},
};
return uiSchema;
-}
+};
const FeedCreatePage: NextPage = () => {
const [formData, setFormData] = useState(null);
@@ -143,21 +145,20 @@ const FeedCreatePage: NextPage = () => {
}
useEffect(() => {
-
getTags()
- .then(res => setTags(res))
- .catch(err => setError(err))
+ .then((res) => setTags(res))
+ .catch((err) => setError(err));
const feedId = id && Number(id);
if (feedId !== undefined) {
getPost(feedId, { auth: true })
- .then(res => setFormData({
+ .then((res) => setFormData({
...res,
- tags: (res.tags).map(inst => inst.id) as any,
+ tags: (res.tags).map((inst) => inst.id) as any,
}))
- .catch(err => setError(err))
+ .catch((err) => setError(err));
}
- }, [id])
+ }, [id]);
const onSubmit = async (data) => {
try {
@@ -178,7 +179,7 @@ const FeedCreatePage: NextPage = () => {
} catch (err) {
setError(err);
}
- }
+ };
const onChange = (data) => setFormData(data.formData);
const onFocus = () => setStatusMessage(null);
@@ -206,7 +207,7 @@ const FeedCreatePage: NextPage = () => {
/>
>
);
-}
+};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
diff --git a/src/pages/admin/feed/index.tsx b/src/pages/admin/feed/index.tsx
index 1922010..03f79c4 100644
--- a/src/pages/admin/feed/index.tsx
+++ b/src/pages/admin/feed/index.tsx
@@ -7,7 +7,7 @@ import { Link } from "@components/index";
import AddLink from "@components/AddLink";
import { Post, getFeed } from "@models/Feed";
-const URL = "/admin/feed"
+const URL = "/admin/feed";
const renderData = (feed: Post[]) => {
if (!feed || feed.length === 0) {
@@ -24,7 +24,7 @@ const renderData = (feed: Post[]) => {
- {feed.map(post => (
+ {feed.map((post) => (
{post.title_fi}
{post.description_fi}
@@ -34,14 +34,14 @@ const renderData = (feed: Post[]) => {
);
-}
+};
const AdminFeedPage: NextPage = () => {
const [forms, setForms] = useState(null);
useEffect(() => {
getFeed({ auth: true })
- .then(res => setForms(res))
+ .then((res) => setForms(res));
}, []);
return (
@@ -56,7 +56,7 @@ const AdminFeedPage: NextPage = () => {
>
);
-}
+};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
diff --git a/src/pages/admin/index.tsx b/src/pages/admin/index.tsx
index 1c6894d..6c100e7 100644
--- a/src/pages/admin/index.tsx
+++ b/src/pages/admin/index.tsx
@@ -3,20 +3,18 @@ import { NextPage, GetServerSideProps } from "next";
import Head from "next/head";
import AdminPageWrapper from "@views/common/AdminPageWrapper";
-const AdminFrontPage: NextPage = () => {
- return (
- <>
-
-
-
-
-
-
SIK Admin
-
-
- >
- )
-};
+const AdminFrontPage: NextPage = () => (
+ <>
+
+
+
+
+
+
SIK Admin
+
+
+ >
+);
export default AdminFrontPage;
diff --git a/src/pages/admin/jobads/[id].tsx b/src/pages/admin/jobads/[id].tsx
index 35084fe..1ef10d3 100644
--- a/src/pages/admin/jobads/[id].tsx
+++ b/src/pages/admin/jobads/[id].tsx
@@ -3,7 +3,9 @@ import { NextPage, GetServerSideProps } from "next";
import Head from "next/head";
import { useRouter } from "next/router";
import AdminCreateCommon from "@views/admin/AdminCreateCommon";
-import { JobAd, getJobAd, createJobAd, updateJobAd } from "@models/JobAd";
+import {
+ JobAd, getJobAd, createJobAd, updateJobAd,
+} from "@models/JobAd";
import DatetimeWidget from "@components/Widgets/DatetimeWidget";
import SectionDividerWidget from "@components/Widgets/SectionDividerWidget";
import MarkdownEditorWidget from "@components/Widgets/MarkdownEditorWidget";
@@ -11,7 +13,7 @@ import MarkdownEditorWidget from "@components/Widgets/MarkdownEditorWidget";
const widgets = {
datetime: DatetimeWidget,
section_divider: SectionDividerWidget,
- markdownEditor: MarkdownEditorWidget
+ markdownEditor: MarkdownEditorWidget,
};
const buildSchema = (formData: JobAd) => {
@@ -45,7 +47,7 @@ const buildSchema = (formData: JobAd) => {
title_fi: {
type: "string",
title: "Title",
- default: ""
+ default: "",
},
description_fi: {
type: "string",
@@ -64,7 +66,7 @@ const buildSchema = (formData: JobAd) => {
title_en: {
type: "string",
title: "Title",
- default: ""
+ default: "",
},
description_en: {
type: "string",
@@ -76,10 +78,10 @@ const buildSchema = (formData: JobAd) => {
title: "Content",
default: "",
},
- }
+ },
};
return schema;
-}
+};
const buildUISchema = (formData: JobAd) => ({
content_fi: {
@@ -94,13 +96,13 @@ const buildUISchema = (formData: JobAd) => ({
finnish_section_divider: {
"ui:widget": "section_divider",
"ui:options": {
- label: false
+ label: false,
},
},
english_section_divider: {
"ui:widget": "section_divider",
"ui:options": {
- label: false
+ label: false,
},
},
});
@@ -110,7 +112,6 @@ const JobAdCreatePage: NextPage = () => {
const [error, setError] = useState(null);
const [statusMessage, setStatusMessage] = useState(null);
-
const router = useRouter();
let id: string;
@@ -123,11 +124,10 @@ const JobAdCreatePage: NextPage = () => {
const jobId = id && Number(id);
if (jobId !== undefined) {
getJobAd(jobId, true)
- .then(res => setFormData(res))
- .catch(err => setError(err))
+ .then((res) => setFormData(res))
+ .catch((err) => setError(err));
}
- }, [id])
-
+ }, [id]);
const onSubmit = async (data) => {
try {
@@ -144,7 +144,7 @@ const JobAdCreatePage: NextPage = () => {
} catch (err) {
setError(err);
}
- }
+ };
const onChange = (data) => setFormData(data.formData);
const onFocus = () => setStatusMessage(null);
@@ -172,8 +172,8 @@ const JobAdCreatePage: NextPage = () => {
/>
>
);
-}
+};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
-export default JobAdCreatePage;
\ No newline at end of file
+export default JobAdCreatePage;
diff --git a/src/pages/admin/jobads/index.tsx b/src/pages/admin/jobads/index.tsx
index 0529fc1..824040a 100644
--- a/src/pages/admin/jobads/index.tsx
+++ b/src/pages/admin/jobads/index.tsx
@@ -7,10 +7,9 @@ import { Link } from "@components/index";
import AddLink from "@components/AddLink";
import { JobAd, getJobAds } from "@models/JobAd";
-const URL = "/admin/jobads"
+const URL = "/admin/jobads";
const renderData = (jobAds: JobAd[]) => {
-
if (!jobAds || jobAds.length === 0) {
return No advertisements.
;
}
@@ -25,7 +24,7 @@ const renderData = (jobAds: JobAd[]) => {
- {jobAds.map(ad => (
+ {jobAds.map((ad) => (
{ad.title_fi}
{ad.description_fi}
@@ -39,17 +38,15 @@ const renderData = (jobAds: JobAd[]) => {
);
-}
-
-
+};
const AdminJobAdPage: NextPage = () => {
const [jobAds, setAds] = useState(null);
useEffect(() => {
getJobAds({ auth: true })
- .then(res => setAds(res))
- }, [])
+ .then((res) => setAds(res));
+ }, []);
return (
<>
@@ -62,9 +59,9 @@ const AdminJobAdPage: NextPage = () => {
{renderData(jobAds)}
>
- )
-}
+ );
+};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
-export default AdminJobAdPage;
\ No newline at end of file
+export default AdminJobAdPage;
diff --git a/src/pages/admin/login.tsx b/src/pages/admin/login.tsx
index 3cdc42b..8738a27 100644
--- a/src/pages/admin/login.tsx
+++ b/src/pages/admin/login.tsx
@@ -21,11 +21,11 @@ const AdminLoginPage: NextPage = () => {
const next = router.query.next as string || DEFAULT_REDIRECT;
useEffect(() => {
- isAuthenticated().then(res => {
+ isAuthenticated().then((res) => {
if (res) {
router.push(next);
}
- })
+ });
}, []);
const handleSubmit = async (e: React.FormEvent) => {
@@ -37,7 +37,7 @@ const AdminLoginPage: NextPage = () => {
} catch (err) {
setError("Failed to log in!");
}
- }
+ };
return (
<>
@@ -59,7 +59,8 @@ const AdminLoginPage: NextPage = () => {
value={username}
onChange={(e) => {
setUsername(e.target.value);
- }} />
+ }}
+ />
Password
{
value={password}
onChange={(e) => {
setPassword(e.target.value);
- }} />
+ }}
+ />
@@ -82,7 +84,7 @@ const AdminLoginPage: NextPage = () => {
>
);
-}
+};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
diff --git a/src/pages/admin/logout.tsx b/src/pages/admin/logout.tsx
index 161a510..9c506ef 100644
--- a/src/pages/admin/logout.tsx
+++ b/src/pages/admin/logout.tsx
@@ -10,6 +10,6 @@ const AdminLogoutPage: NextPage = () => {
router.push("/admin/login");
}
return null;
-}
+};
export default AdminLogoutPage;
diff --git a/src/pages/admin/signups/[id].tsx b/src/pages/admin/signups/[id].tsx
index 2764602..f3c154a 100644
--- a/src/pages/admin/signups/[id].tsx
+++ b/src/pages/admin/signups/[id].tsx
@@ -3,7 +3,9 @@ import { NextPage, GetServerSideProps } from "next";
import Head from "next/head";
import { useRouter } from "next/router";
import AdminCreateCommon from "@views/admin/AdminCreateCommon";
-import { SignupForm, createForm, getForm, updateForm } from "@models/SignupForm";
+import {
+ SignupForm, createForm, getForm, updateForm,
+} from "@models/SignupForm";
import DatetimeWidget from "@components/Widgets/DatetimeWidget";
import SignupQuestionsWidget from "@components/Widgets/SignupQuestionsWidget";
import MarkdownEditorWidget from "@components/Widgets/MarkdownEditorWidget";
@@ -12,13 +14,11 @@ import { buildValidationSchema } from "@views/SignUpPage/FormUtils";
const DEFAULT_EMAIL =
`Moikka,
-Ilmottautuminen saapui perille.`
-;
-
+Ilmottautuminen saapui perille.`;
const widgets = {
datetime: DatetimeWidget,
signup: SignupQuestionsWidget,
- markdownEditor: MarkdownEditorWidget
+ markdownEditor: MarkdownEditorWidget,
};
const buildSchema = (formData: SignupForm) => {
@@ -67,7 +67,7 @@ const buildSchema = (formData: SignupForm) => {
email_content: {
type: "string",
title: "Email on signup",
- default: DEFAULT_EMAIL
+ default: DEFAULT_EMAIL,
},
questions: {
type: "string",
@@ -77,7 +77,7 @@ const buildSchema = (formData: SignupForm) => {
},
};
return schema;
-}
+};
const buildUISchema = () => {
const uiSchema = {
@@ -95,7 +95,7 @@ const buildUISchema = () => {
},
};
return uiSchema;
-}
+};
const SignupCreatePage: NextPage = () => {
const [formData, setFormData] = useState(null);
@@ -114,15 +114,15 @@ const SignupCreatePage: NextPage = () => {
const suId = id && Number(id);
if (suId !== undefined) {
getForm(suId, true)
- .then(res => {
+ .then((res) => {
setFormData({
...res,
- questions: JSON.stringify(res.questions) as any
+ questions: JSON.stringify(res.questions) as any,
});
})
- .catch(err => setError(err))
+ .catch((err) => setError(err));
}
- }, [id])
+ }, [id]);
const onSubmit = async (data: any) => {
try {
@@ -130,28 +130,28 @@ const SignupCreatePage: NextPage = () => {
const payload: SignupForm = {
...data.formData,
questions,
- schema: buildValidationSchema(questions)
- }
+ schema: buildValidationSchema(questions),
+ };
if (payload.id === undefined) {
const resp = await createForm(payload);
setStatusMessage("Sign-up created successfully");
setFormData({
...resp,
- questions: JSON.stringify(resp.questions) as any
+ questions: JSON.stringify(resp.questions) as any,
});
} else {
const resp = await updateForm(payload);
setStatusMessage("Sign-up updated successfully");
setFormData({
...resp,
- questions: JSON.stringify(resp.questions) as any
+ questions: JSON.stringify(resp.questions) as any,
});
}
} catch (err) {
setError(err);
}
- }
+ };
const onChange = (data) => setFormData(data.formData);
const onFocus = () => setStatusMessage(null);
@@ -182,7 +182,7 @@ const SignupCreatePage: NextPage = () => {
} */}
>
);
-}
+};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
diff --git a/src/pages/admin/signups/[id]/email.tsx b/src/pages/admin/signups/[id]/email.tsx
index 2b2cb06..71c4ab1 100644
--- a/src/pages/admin/signups/[id]/email.tsx
+++ b/src/pages/admin/signups/[id]/email.tsx
@@ -6,38 +6,36 @@ import MarkdownEditorWidget from "@components/Widgets/MarkdownEditorWidget";
import { SignupForm, getForm, signupFormSendEmail } from "@models/SignupForm";
const widgets = {
- markdownEditor: MarkdownEditorWidget
+ markdownEditor: MarkdownEditorWidget,
};
-const buildSchema = (title: string) => {
- return {
- title,
- type: "object",
- required: ["subject", "content", "mode"],
- properties: {
- subject: {
- type: "string",
- title: "Title",
- default: ""
- },
- content: {
- type: "string",
- title: "Content",
- default: "",
- },
- mode: {
- type: "string",
- title: "Send to",
- enum: [
- "all",
- "actual",
- "reserved"
- ],
- default: "all",
- }
- }
- };
-}
+const buildSchema = (title: string) => ({
+ title,
+ type: "object",
+ required: ["subject", "content", "mode"],
+ properties: {
+ subject: {
+ type: "string",
+ title: "Title",
+ default: "",
+ },
+ content: {
+ type: "string",
+ title: "Content",
+ default: "",
+ },
+ mode: {
+ type: "string",
+ title: "Send to",
+ enum: [
+ "all",
+ "actual",
+ "reserved",
+ ],
+ default: "all",
+ },
+ },
+});
const buildUISchema = () => ({
content: {
@@ -45,7 +43,6 @@ const buildUISchema = () => ({
},
});
-
const SignupEmailPage: NextPage = () => {
const [signupForm, setSignupForm] = useState(null);
@@ -56,11 +53,9 @@ const SignupEmailPage: NextPage = () => {
const formId = Number(id);
if (formId !== undefined) {
getForm(formId, true)
- .then(res => setSignupForm(res))
+ .then((res) => setSignupForm(res));
}
- }, [id])
-
-
+ }, [id]);
const [error, setError] = useState(null);
const [statusMessage, setStatusMessage] = useState(null);
@@ -73,12 +68,12 @@ const SignupEmailPage: NextPage = () => {
} catch (err) {
setError(err);
}
- }
+ };
// const onChange = (data) => setFormData(data.formData);
const onFocus = () => setStatusMessage(null);
- const title = signupForm ? signupForm.title_fi : "Loading..."
+ const title = signupForm ? signupForm.title_fi : "Loading...";
return (
{
error={error}
widgets={widgets}
/>
- )
+ );
};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
diff --git a/src/pages/admin/signups/[id]/list.tsx b/src/pages/admin/signups/[id]/list.tsx
index 01cdd7d..aed4934 100644
--- a/src/pages/admin/signups/[id]/list.tsx
+++ b/src/pages/admin/signups/[id]/list.tsx
@@ -23,33 +23,31 @@ const SignupEmailPage: NextPage = () => {
useEffect(() => {
const formId = Number(id);
getForm(formId, true)
- .then(res => setSignupForm(res))
-
- getSignups(formId).then(res => setSignups(res))
+ .then((res) => setSignupForm(res));
+ getSignups(formId).then((res) => setSignups(res));
}, [id]);
const confirmDelete = async (signup: Signup, question: any) => {
- if (confirm(`Delete: ${signup.id}: ${signup.answer[question.id]}; Are you sure?`) === true) {
+ if (window.confirm(`Delete: ${signup.id}: ${signup.answer[question.id]}; Are you sure?`) === true) {
try {
await deleteSignup(signup.id);
- setSignups(signups.filter(s => s.id !== signup.id))
+ setSignups(signups.filter((s) => s.id !== signup.id));
} catch (err) {
- alert("Delete failed!")
+ window.alert("Delete failed!");
}
}
- }
-
+ };
const title = signupForm ? signupForm.title_fi : "Loading...";
- const questions = signupForm ? signupForm.questions.map(q => ({
+ const questions = signupForm ? signupForm.questions.map((q) => ({
title: q.name,
- id: q.id
+ id: q.id,
})) : [];
// Generate 2-dimensional array where rows are signups and columns are answers to questions.
- const CSVData = signups.map((s) => questions.map(q => s.answer[q.id]));
+ const CSVData = signups.map((s) => questions.map((q) => s.answer[q.id]));
// Add reserve signup "header"
if (signupForm?.quota) {
CSVData.splice(signupForm.quota, 0, ["RESERVE-SIGNUPS"]);
@@ -61,11 +59,11 @@ const SignupEmailPage: NextPage = () => {
- {questions.map(q => (
+ {questions.map((q) => (
{q.title}
))}
- q.title)} separator=";">
+ q.title)} separator=";">
Download CSV
@@ -75,9 +73,9 @@ const SignupEmailPage: NextPage = () => {
- {signups.map(s => (
+ {signups.map((s) => (
- {questions.map(q => (
+ {questions.map((q) => (
{s.answer[q.id]}
@@ -92,7 +90,7 @@ const SignupEmailPage: NextPage = () => {
- )
+ );
};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
diff --git a/src/pages/admin/signups/index.tsx b/src/pages/admin/signups/index.tsx
index eafc576..84b5f76 100644
--- a/src/pages/admin/signups/index.tsx
+++ b/src/pages/admin/signups/index.tsx
@@ -7,7 +7,7 @@ import { Link } from "@components/index";
import AddLink from "@components/AddLink";
import { SignupForm, getForms } from "@models/SignupForm";
-const URL = "/admin/signups"
+const URL = "/admin/signups";
const renderData = (signupForms: SignupForm[]) => {
if (!signupForms || signupForms.length === 0) {
@@ -26,7 +26,7 @@ const renderData = (signupForms: SignupForm[]) => {
- {signupForms.map(signupForm => (
+ {signupForms.map((signupForm) => (
{signupForm.title_fi}
{formatRelative(new Date(signupForm.start_time), new Date())}
@@ -38,14 +38,14 @@ const renderData = (signupForms: SignupForm[]) => {
);
-}
+};
const AdminSignupPage: NextPage = () => {
const [forms, setForms] = useState(null);
useEffect(() => {
getForms(true)
- .then(res => setForms(res))
+ .then((res) => setForms(res));
}, []);
return (
@@ -60,7 +60,7 @@ const AdminSignupPage: NextPage = () => {
>
);
-}
+};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
diff --git a/src/pages/events/[id].tsx b/src/pages/events/[id].tsx
index ce0250e..de73e56 100644
--- a/src/pages/events/[id].tsx
+++ b/src/pages/events/[id].tsx
@@ -2,7 +2,9 @@ import React from "react";
import { NextPage, GetServerSideProps } from "next";
import Head from "next/head";
import { useRouter } from "next/router";
-import { Event, useFetchEvents, eventFetcher, generateFetchParams } from "@models/Event";
+import {
+ Event, useFetchEvents, eventFetcher, generateFetchParams,
+} from "@models/Event";
import EventPageView from "@views/EventPage/EventPageView";
import PageWrapper from "@views/common/PageWrapper";
@@ -14,7 +16,7 @@ const EventPage: NextPage = ({ initialEvent }) => {
const router = useRouter();
const { id } = router.query;
const { data, error } = useFetchEvents({ initialData: initialEvent, id: id as string });
- if (!data) return Loading
+ if (!data) return Loading
;
return (
<>
@@ -26,10 +28,10 @@ const EventPage: NextPage = ({ initialEvent }) => {
>
);
-}
+};
export const getServerSideProps: GetServerSideProps = async (context) => {
- const { id } = context.query
+ const { id } = context.query;
const { url, config } = generateFetchParams(id as string);
const initialEvent = await eventFetcher(url, config);
return {
diff --git a/src/pages/in_english.tsx b/src/pages/in_english.tsx
index dc1575a..058347b 100644
--- a/src/pages/in_english.tsx
+++ b/src/pages/in_english.tsx
@@ -4,7 +4,7 @@ import Head from "next/head";
import InEnglishPageView from "@views/InEnglishPage/InEnglishPageView";
import PageWrapper from "@views/common/PageWrapper";
-const InEnglishPage: NextPage= () => (
+const InEnglishPage: NextPage = () => (
<>
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 0f4938e..b4350ad 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -1,15 +1,19 @@
import React from "react";
import { NextPage, GetServerSideProps } from "next";
import Head from "next/head";
-import { Event, useFetchEvents, eventFetcher, generateFetchParams as eventParams } from "@models/Event";
-import { Post, useFetchFeed, feedFetcher, generateFetchParams as feedParams } from "@models/Feed";
+import {
+ Event, useFetchEvents, eventFetcher, generateFetchParams as eventParams,
+} from "@models/Event";
+import {
+ Post, useFetchFeed, feedFetcher, generateFetchParams as feedParams,
+} from "@models/Feed";
import FrontPageView from "@views/FrontPage/FrontPageView";
import PageWrapper from "@views/common/PageWrapper";
const eventOptions = {
onlyNonPast: true,
limit: 4,
-}
+};
interface InitialProps {
initialEvents: Event[];
@@ -29,7 +33,8 @@ const FrontPage: NextPage = ({ initialEvents, initialFeed }) => {
>
- )};
+ );
+};
export const getServerSideProps: GetServerSideProps = async () => {
let url: string;
diff --git a/src/pages/kilta/fuksi.tsx b/src/pages/kilta/fuksi.tsx
index cb84f9e..dfe80af 100644
--- a/src/pages/kilta/fuksi.tsx
+++ b/src/pages/kilta/fuksi.tsx
@@ -13,6 +13,6 @@ const FreshmenPage: NextPage = () => (
>
-)
+);
export default FreshmenPage;
diff --git a/src/pages/kilta/kunnia.tsx b/src/pages/kilta/kunnia.tsx
index adcee91..1f9b285 100644
--- a/src/pages/kilta/kunnia.tsx
+++ b/src/pages/kilta/kunnia.tsx
@@ -13,6 +13,6 @@ const HonoraryPage: NextPage = () => (
>
-)
+);
export default HonoraryPage;
diff --git a/src/pages/kilta/toiminta.tsx b/src/pages/kilta/toiminta.tsx
index 4cc9c49..1353b9b 100644
--- a/src/pages/kilta/toiminta.tsx
+++ b/src/pages/kilta/toiminta.tsx
@@ -1,14 +1,18 @@
import React from "react";
import { NextPage, GetServerSideProps } from "next";
import Head from "next/head";
-import { Event, useFetchEvents, eventFetcher, generateFetchParams as eventParams } from "@models/Event";
-import { Post, useFetchFeed, feedFetcher, generateFetchParams as feedParams } from "@models/Feed";
+import {
+ Event, useFetchEvents, eventFetcher, generateFetchParams as eventParams,
+} from "@models/Event";
+import {
+ Post, useFetchFeed, feedFetcher, generateFetchParams as feedParams,
+} from "@models/Feed";
import ActualPageView from "@views/ActualPage/ActualPageView";
import PageWrapper from "@views/common/PageWrapper";
const eventOptions = {
onlyNonPast: true,
-}
+};
interface InitialProps {
initialEvents: Event[];
@@ -28,8 +32,8 @@ const ActualPage: NextPage = ({ initialEvents, initialFeed }) => {
>
- )
-}
+ );
+};
export const getServerSideProps: GetServerSideProps = async () => {
let url: string;
diff --git a/src/pages/signup/[...params].tsx b/src/pages/signup/[...params].tsx
index 95fe292..71b0d66 100644
--- a/src/pages/signup/[...params].tsx
+++ b/src/pages/signup/[...params].tsx
@@ -3,7 +3,9 @@ import { NextPage, GetServerSideProps } from "next";
import Head from "next/head";
import { useRouter } from "next/router";
import { getForm, SignupForm } from "@models/SignupForm";
-import { createSignup, updateSignup, getSignupUUID, Signup } from "@models/Signup";
+import {
+ createSignup, updateSignup, getSignupUUID, Signup,
+} from "@models/Signup";
import SignUpPageView from "@views/SignUpPage/SignUpPageView";
import PageWrapper from "@views/common/PageWrapper";
import noop from "@utils/noop";
@@ -19,16 +21,14 @@ const parseQueryParams = (params: any) => {
formId = params?.[0];
}
-
return {
formId,
signupId,
- uuid
- }
-}
+ uuid,
+ };
+};
const SignUpPage: NextPage = () => {
-
const router = useRouter();
const { formId, signupId, uuid } = parseQueryParams(router.query.params);
@@ -39,28 +39,28 @@ const SignUpPage: NextPage = () => {
useEffect(() => {
const fetchSignUpForm = async (id: number): Promise => {
const formPromise = getForm(id);
- formPromise.then(form => {
+ formPromise.then((form) => {
setForm(form);
});
return formPromise;
- }
+ };
- const fetchSignUp = async (id: number, uuid: string): Promise => {
- const signupPromise = getSignupUUID(id, uuid);
- signupPromise.then(signup => setFormData(signup.answer));
+ const fetchSignUp = async (id: number, uniqueId: string): Promise => {
+ const signupPromise = getSignupUUID(id, uniqueId);
+ signupPromise.then((signup) => setFormData(signup.answer));
return signupPromise;
- }
+ };
if (signupId) {
- fetchSignUp(signupId, uuid).then(s => fetchSignUpForm(s.signupForm_id));
+ fetchSignUp(signupId, uuid).then((s) => fetchSignUpForm(s.signupForm_id));
} else if (formId) {
- fetchSignUpForm(formId)
+ fetchSignUpForm(formId);
}
- }, [formId, signupId, uuid])
+ }, [formId, signupId, uuid]);
const onSubmit = async (data) => {
const payload: Signup = {
- id: signupId ? Number(signupId): undefined,
+ id: signupId ? Number(signupId) : undefined,
signupForm_id: signUpForm.id,
answer: data.formData,
};
@@ -70,8 +70,7 @@ const SignUpPage: NextPage = () => {
const resp = await updateSignup(payload, uuid);
// TODO: Update signup list, so user sees possible changes in the list
setStatus("Sign-up submission updated successfully");
- }
- else {
+ } else {
const resp = await createSignup(payload);
// TODO: Fetch/update signup list, so user sees the signup in the list
setStatus("Sign-up submitted successfully");
@@ -80,7 +79,7 @@ const SignUpPage: NextPage = () => {
console.error(error);
setStatus("Bad request");
}
- }
+ };
return (
<>
@@ -98,7 +97,7 @@ const SignUpPage: NextPage = () => {
>
);
-}
+};
export const getServerSideProps: GetServerSideProps = async () => ({ props: {} });
diff --git a/src/pages/yritysyhteistyo.tsx b/src/pages/yritysyhteistyo.tsx
index b945457..094e52b 100644
--- a/src/pages/yritysyhteistyo.tsx
+++ b/src/pages/yritysyhteistyo.tsx
@@ -1,7 +1,9 @@
import React from "react";
import { NextPage, GetServerSideProps } from "next";
import Head from "next/head";
-import { JobAd, useFetchJobAds, jobAdFetcher, generateFetchParams } from "@models/JobAd";
+import {
+ JobAd, useFetchJobAds, jobAdFetcher, generateFetchParams,
+} from "@models/JobAd";
import CorporatePageView from "@views/CorporatePage/CorporatePageView";
import PageWrapper from "@views/common/PageWrapper";
@@ -10,8 +12,7 @@ interface InitialProps {
}
const CorporatePage: NextPage = ({ initialJobAds }) => {
-
- const { data, error } = useFetchJobAds({ initialData: initialJobAds })
+ const { data, error } = useFetchJobAds({ initialData: initialJobAds });
return (
<>
@@ -22,16 +23,16 @@ const CorporatePage: NextPage = ({ initialJobAds }) => {
>
);
-}
+};
export const getServerSideProps: GetServerSideProps = async () => {
const { url } = generateFetchParams();
const initialJobAds = await jobAdFetcher(url);
return {
props: {
- initialJobAds
- }
- }
-}
+ initialJobAds,
+ },
+ };
+};
export default CorporatePage;
diff --git a/src/theme/breakpoints.ts b/src/theme/breakpoints.ts
index f129351..d422c56 100644
--- a/src/theme/breakpoints.ts
+++ b/src/theme/breakpoints.ts
@@ -4,11 +4,11 @@ const breakpointsNumber: Record = {
mobile: 800,
medium: 1200,
large: 1920,
- xlarge: 2560
-}
+ xlarge: 2560,
+};
const breakpoints = Object.fromEntries(
- Object.entries(breakpointsNumber).map(([k, v]) => [k, `${v}px`])
+ Object.entries(breakpointsNumber).map(([k, v]) => [k, `${v}px`]),
);
-export default breakpoints as Record;
\ No newline at end of file
+export default breakpoints as Record;
diff --git a/src/theme/colors.ts b/src/theme/colors.ts
index 70ba0a4..a5be09b 100644
--- a/src/theme/colors.ts
+++ b/src/theme/colors.ts
@@ -28,7 +28,7 @@ export const ColorMapper = new Map([
["green1", "#c0dcd9"],
["sand", "#fdf9d7"],
["transparent", "transparent"],
- ["inherit", "inherit"]
+ ["inherit", "inherit"],
]);
export const colors = {
@@ -45,14 +45,14 @@ export const colors = {
green1: "#c0dcd9",
sand: "#fdf9d7",
transparent: "transparent",
- inherit: "inherit"
-}
+ inherit: "inherit",
+};
export type Colors2 = keyof typeof colors;
-export const colorToClass = (color: Colors): string => color ? `color-div__${color}` : undefined;
-export const bgColorToClass = (color: Colors): string => color ? `color-div__background_${color}` : undefined;
-export const hoverColorToClass = (color: Colors): string => color ? `color-div__${color}Hoverable` : undefined;
-export const bgHoverColorToClass = (color: Colors): string => color ? `color-div__background_${color}Hoverable` : undefined;
+export const colorToClass = (color: Colors): string => (color ? `color-div__${color}` : undefined);
+export const bgColorToClass = (color: Colors): string => (color ? `color-div__background_${color}` : undefined);
+export const hoverColorToClass = (color: Colors): string => (color ? `color-div__${color}Hoverable` : undefined);
+export const bgHoverColorToClass = (color: Colors): string => (color ? `color-div__background_${color}Hoverable` : undefined);
-export default colors;
\ No newline at end of file
+export default colors;
diff --git a/src/utils/auth.ts b/src/utils/auth.ts
index dac7c87..604401d 100644
--- a/src/utils/auth.ts
+++ b/src/utils/auth.ts
@@ -10,7 +10,7 @@ export async function generateToken(username: string, password: string): Promise
username,
password,
});
- return resp.data["token"];
+ return resp.data.token;
} catch (err) {
console.error(err);
throw err;
diff --git a/src/utils/regexes.ts b/src/utils/regexes.ts
index 726ddc0..b1b17f3 100644
--- a/src/utils/regexes.ts
+++ b/src/utils/regexes.ts
@@ -1,4 +1,3 @@
-
// HTML 5 email regex
-export const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
+export const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
// export const EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
diff --git a/src/views/ActualPage/ActualPageHero.tsx b/src/views/ActualPage/ActualPageHero.tsx
index 8a44dda..deb54f6 100644
--- a/src/views/ActualPage/ActualPageHero.tsx
+++ b/src/views/ActualPage/ActualPageHero.tsx
@@ -1,5 +1,7 @@
import React from "react";
-import { Hero, HeroPrimarySection, HeroSecondarySection, HeroSecondarySectionItem, HeroAside, HeroAsideItem, HeroPrimaryButtons } from "@components/Hero";
+import {
+ Hero, HeroPrimarySection, HeroSecondarySection, HeroSecondarySectionItem, HeroAside, HeroAsideItem, HeroPrimaryButtons,
+} from "@components/Hero";
import { Link } from "@components/index";
import noop from "@utils/noop";
@@ -11,12 +13,12 @@ const ActualPageHero: React.FC = () => (
>
-
+
Tapahtumat ›
-
+
Uutiset ›
@@ -29,43 +31,47 @@ const ActualPageHero: React.FC = () => (
-
+ linkText="Elektroniikkapaja ›"
+ />
-
+ linkText="Urheilu ›"
+ />
-
+ linkText="Kulttuuri ›"
+ />
-
+ linkText="Yritysyhteistyö ›"
+ />
-
+ linkText="Ulkoiset suhteet ›"
+ />
- Killan hallitus päivystää kiltahuoneella maanantaisin klo 12.15–13.15. Tuolloin voit ostaa kiltatuotteita, kuten esim. haalarimerkkejä tai laulukirjoja.
+
+ Killan hallitus päivystää kiltahuoneella maanantaisin klo 12.15–13.15. Tuolloin voit ostaa kiltatuotteita, kuten esim. haalarimerkkejä tai laulukirjoja.
+
- Kiltapäiväkerho Kiltis kokoontuu torstaisin klo XX.XX kiltahuoneella. Lorem ipsum dolor sit amet. Lämpimästi tervetuloa kaikki SIKkiläiset ja SIK-mieliset!
+
+ Kiltapäiväkerho Kiltis kokoontuu torstaisin klo XX.XX kiltahuoneella. Lorem ipsum dolor sit amet. Lämpimästi tervetuloa kaikki SIKkiläiset ja SIK-mieliset!
+
-)
+);
-export default ActualPageHero;
\ No newline at end of file
+export default ActualPageHero;
diff --git a/src/views/ActualPage/ActualPageView.tsx b/src/views/ActualPage/ActualPageView.tsx
index 8e59127..903069a 100644
--- a/src/views/ActualPage/ActualPageView.tsx
+++ b/src/views/ActualPage/ActualPageView.tsx
@@ -3,12 +3,13 @@ import styled from "styled-components";
import { Event } from "@models/Event";
import { Post } from "@models/Feed";
-import { Divider, CTASection, TextSection, Accordion } from "@components/index";
+import {
+ Divider, CTASection, TextSection, Accordion,
+} from "@components/index";
import ActualPageHero from "./ActualPageHero";
import EventCalendar from "./EventCalendar";
import News from "./News";
-
interface ActualPageViewProps {
events: Event[];
feed: Post[];
@@ -25,66 +26,64 @@ const Gallery = styled.div`
}
`;
-const ActualPageView: React.FC = ({events, feed}) => {
- return (
- <>
-
+const ActualPageView: React.FC = ({ events, feed }) => (
+ <>
+
-
+
-
+
-
+
-
- Kuvia tapahtumista.
-
+
+ Kuvia tapahtumista.
+
-
-
-
-
-
+
+
+
+
+
-
- Sinustako kilta-aktiivi?
-
+
+ Sinustako kilta-aktiivi?
+
-
- Yritystapahtumia ja vastapainoa opiskelulle
+
+ Yritystapahtumia ja vastapainoa opiskelulle
+
+
+ Toimintaa ylläpitää ja järjestää jaokset ja toimikunnat.
+
-
- Toimintaa ylläpitää ja järjestää jaokset ja toimikunnat.
-
-
-
- Jotain elepajasta
-
-
- Jotain elepajasta
-
-
- Jotain elepajasta
-
-
- Jotain elepajasta
-
-
- Jotain elepajasta
-
-
+
+ Jotain elepajasta
+
+
+ Jotain elepajasta
+
+
+ Jotain elepajasta
+
+
+ Jotain elepajasta
+
+
+ Jotain elepajasta
+
-
- >
- );
-}
+
+
+ >
+);
export default ActualPageView;
diff --git a/src/views/ActualPage/EventCalendar.tsx b/src/views/ActualPage/EventCalendar.tsx
index 5b64204..6572047 100644
--- a/src/views/ActualPage/EventCalendar.tsx
+++ b/src/views/ActualPage/EventCalendar.tsx
@@ -10,7 +10,7 @@ interface EventCalendarProps {
events: Event[];
}
-const EventCalendar: React.FC = ({events}) => {
+const EventCalendar: React.FC = ({ events }) => {
const [filterSelected, setFilter] = useState(0);
const [numberShown, setNumberShown] = useState(8);
const filteredEvents = events.slice(0, numberShown);
@@ -19,20 +19,20 @@ const EventCalendar: React.FC = ({events}) => {
Tapahtumat
- { setFilter(0) }} selected={filterSelected === 0}>
- Näytä kaikki
+ { setFilter(0); }} selected={filterSelected === 0}>
+ Näytä kaikki
- { setFilter(1) }} selected={filterSelected === 1}>
- Järjestä aihettain ›
+ { setFilter(1); }} selected={filterSelected === 1}>
+ Järjestä aihettain ›
- { setFilter(2) }} selected={filterSelected === 2}>
- Valitse aika ›
+ { setFilter(2); }} selected={filterSelected === 2}>
+ Valitse aika ›
- {filteredEvents.map(e => (
+ {filteredEvents.map((e) => (
= ({events}) => {
text={e.description_fi}
link={`/events/${e.id}`}
buttonOnClick={noop}
- >
-
+ />
))}
- { numberShown < events.length && (
+ { numberShown < events.length && (
- { setNumberShown(numberShown + 8) }}>
+ { setNumberShown(numberShown + 8); }}>
Lataa lisää
)}
- )
-}
+ );
+};
-export default EventCalendar;
\ No newline at end of file
+export default EventCalendar;
diff --git a/src/views/ActualPage/FilterContainer.tsx b/src/views/ActualPage/FilterContainer.tsx
index 3900c44..f095c51 100644
--- a/src/views/ActualPage/FilterContainer.tsx
+++ b/src/views/ActualPage/FilterContainer.tsx
@@ -7,4 +7,4 @@ const FilterContainer = styled.div`
justify-content: center;
`;
-export default FilterContainer;
\ No newline at end of file
+export default FilterContainer;
diff --git a/src/views/ActualPage/News.tsx b/src/views/ActualPage/News.tsx
index a86d006..71af861 100644
--- a/src/views/ActualPage/News.tsx
+++ b/src/views/ActualPage/News.tsx
@@ -10,7 +10,7 @@ interface NewsProps {
feed: Post[];
}
-const News: React.FC = ({feed}) => {
+const News: React.FC = ({ feed }) => {
const [filterSelected, setFilter] = useState(0);
const [numberShown, setNumberShown] = useState(8);
const filteredFeed = feed.slice(0, numberShown);
@@ -19,19 +19,19 @@ const News: React.FC = ({feed}) => {
Uutiset
- { setFilter(0) }} selected={filterSelected === 0}>
- Näytä kaikki
+ { setFilter(0); }} selected={filterSelected === 0}>
+ Näytä kaikki
- { setFilter(1) }} selected={filterSelected === 1}>
- Järjestä aihettain ›
+ { setFilter(1); }} selected={filterSelected === 1}>
+ Järjestä aihettain ›
- { setFilter(2) }} selected={filterSelected === 2}>
- Valitse aika ›
+ { setFilter(2); }} selected={filterSelected === 2}>
+ Valitse aika ›
- {filteredFeed.map(post => (
+ {filteredFeed.map((post) => (
= ({feed}) => {
text={post.description_fi}
link={`/feed/${post.id}`}
buttonOnClick={noop}
- >
-
+ />
))}
- { numberShown < feed.length && (
+ { numberShown < feed.length && (
- { setNumberShown(numberShown + 8) }}>
+ { setNumberShown(numberShown + 8); }}>
Lataa lisää
)}
- )
-}
+ );
+};
-export default News;
\ No newline at end of file
+export default News;
diff --git a/src/views/ContactsPage/ContactsPageView.tsx b/src/views/ContactsPage/ContactsPageView.tsx
index 6e3a5bd..ebb5ce1 100644
--- a/src/views/ContactsPage/ContactsPageView.tsx
+++ b/src/views/ContactsPage/ContactsPageView.tsx
@@ -1,9 +1,9 @@
import React from "react";
import styled from "styled-components";
import CommitteeContainer from "@components/CommitteeContainer";
-import { Divider, TextSection } from "@components/index";
+import { Divider, TextSection, Link } from "@components/index";
import { colors } from "@theme/colors";
-import { Link } from "@components/index";
+
import BoardJson from "@assets/json/board.json";
import HvtmkJson from "@assets/json/hvtmk.json";
import MtmkJson from "@assets/json/mtmk.json";
@@ -65,7 +65,7 @@ const ContactsPageView: React.FC = () => (
-
+
@@ -73,7 +73,7 @@ const ContactsPageView: React.FC = () => (
-
+
@@ -81,7 +81,7 @@ const ContactsPageView: React.FC = () => (
-
+
@@ -89,7 +89,7 @@ const ContactsPageView: React.FC = () => (
-
+
@@ -97,7 +97,7 @@ const ContactsPageView: React.FC = () => (
-
+
@@ -105,7 +105,7 @@ const ContactsPageView: React.FC = () => (
-
+
@@ -113,7 +113,7 @@ const ContactsPageView: React.FC = () => (
-
+
@@ -121,7 +121,7 @@ const ContactsPageView: React.FC = () => (
-
+
@@ -129,7 +129,7 @@ const ContactsPageView: React.FC = () => (
-
+
@@ -137,6 +137,6 @@ const ContactsPageView: React.FC = () => (
>
-)
+);
-export default ContactsPageView;
\ No newline at end of file
+export default ContactsPageView;
diff --git a/src/views/CorporatePage/CorporatePageHero.tsx b/src/views/CorporatePage/CorporatePageHero.tsx
index a16c222..18ed355 100644
--- a/src/views/CorporatePage/CorporatePageHero.tsx
+++ b/src/views/CorporatePage/CorporatePageHero.tsx
@@ -1,5 +1,7 @@
import React from "react";
-import { Hero, HeroPrimarySection, HeroAside, HeroAsideItem } from "@components/Hero";
+import {
+ Hero, HeroPrimarySection, HeroAside, HeroAsideItem,
+} from "@components/Hero";
const CorporatePageHero: React.FC = () => (
@@ -12,15 +14,18 @@ const CorporatePageHero: React.FC = () => (
+ linkText="Yhteistyömahdollisuudet"
+ />
+ linkText="Työpaikkailmoitukset"
+ />
+ linkText="Killan LinkedIn ryhmä"
+ />
);
diff --git a/src/views/CorporatePage/CorporatePageView.tsx b/src/views/CorporatePage/CorporatePageView.tsx
index 4273ccd..1ebbe64 100644
--- a/src/views/CorporatePage/CorporatePageView.tsx
+++ b/src/views/CorporatePage/CorporatePageView.tsx
@@ -1,11 +1,13 @@
import React from "react";
import CorporatePageHero from "./CorporatePageHero";
-import { CTASection, TextSection, PageLink, Link } from "@components/index";
+import {
+ CTASection, TextSection, PageLink, Link,
+} from "@components/index";
import { JobAd } from "@models/JobAd";
import JobAdList from "./JobAdList";
const EXCURSION_RULES = "https://static.sika.sik.party/saannot/excursiosaannot.pdf";
-const YTMK_MAIL = "sik-yritys@list.ayy.fi"
+const YTMK_MAIL = "sik-yritys@list.ayy.fi";
interface CorporatePageViewProps {
jobAds: JobAd[];
@@ -60,7 +62,7 @@ const CorporatePageView: React.FC = ({ jobAds }) => (
Yllämainituista mahdollisuuksista, sekä muista ideoista kiinnostuneena, voit olla yhteydessä Yrityssuhdemestariimme Jarnoon.
Yrityssuhdemestari
-
Jarno Mustonen 050 123 4567 jarno.mustonen@aalto.fi
+
Jarno Mustonen 050 123 4567 jarno.mustonen@aalto.fi
diff --git a/src/views/CorporatePage/JobAdList.tsx b/src/views/CorporatePage/JobAdList.tsx
index 833da33..ad44b09 100644
--- a/src/views/CorporatePage/JobAdList.tsx
+++ b/src/views/CorporatePage/JobAdList.tsx
@@ -32,6 +32,6 @@ const JobAdList: React.FC = ({ jobAds }) => (
))}
-)
+);
export default JobAdList;
diff --git a/src/views/EventPage/EventPageView.tsx b/src/views/EventPage/EventPageView.tsx
index 46aec77..cedd7a3 100644
--- a/src/views/EventPage/EventPageView.tsx
+++ b/src/views/EventPage/EventPageView.tsx
@@ -3,9 +3,9 @@ import styled from "styled-components";
import colors from "@theme/colors";
import { Event } from "@models/Event";
import Button from "@components/Button";
-import { Link } from "@components/index";
+import { Link, TextSection } from "@components/index";
import noop from "@utils/noop";
-import { TextSection } from "@components/index";
+
import MarkdownStyles from "@views/common/MarkdownStyles";
interface EventPageViewProps {
@@ -39,7 +39,7 @@ const Content = styled(MarkdownStyles)`
`;
const EventPageView: React.FC = ({ event }) => {
- if (!event) return Loading
+ if (!event) return Loading
;
return (
@@ -55,17 +55,16 @@ const EventPageView: React.FC = ({ event }) => {
{/* We may have multiple signup forms. Generate own Button for each one */}
- {event.signupForm.map(sf => (
+ {event.signupForm.map((sf) => (
{sf.title_fi}
- )
- )}
+ ))}
);
-}
+};
export default EventPageView;
diff --git a/src/views/FreshmenPage/FreshmenPageHero.tsx b/src/views/FreshmenPage/FreshmenPageHero.tsx
index 69e5952..f67d9bd 100644
--- a/src/views/FreshmenPage/FreshmenPageHero.tsx
+++ b/src/views/FreshmenPage/FreshmenPageHero.tsx
@@ -1,5 +1,7 @@
import React from "react";
-import { Hero, HeroPrimarySection, HeroAside, HeroAsideItem } from "@components/Hero";
+import {
+ Hero, HeroPrimarySection, HeroAside, HeroAsideItem,
+} from "@components/Hero";
const FreshmenPageHero: React.FC = () => (
@@ -12,19 +14,23 @@ const FreshmenPageHero: React.FC = () => (
+ linkText="Liity killan Telegram-ryhmiin"
+ />
+ linkText="Lue fuksiopas"
+ />
+ linkText="Lue korkeakoulun tietopaketti"
+ />
+ linkText="Tsekkaa ISO-henkilöiden tiedot"
+ />
);
diff --git a/src/views/FreshmenPage/FreshmenPageView.tsx b/src/views/FreshmenPage/FreshmenPageView.tsx
index 117028c..e1bf1fa 100644
--- a/src/views/FreshmenPage/FreshmenPageView.tsx
+++ b/src/views/FreshmenPage/FreshmenPageView.tsx
@@ -1,11 +1,13 @@
import React from "react";
import styled from "styled-components";
import FreshmenPageHero from "./FreshmenPageHero";
-import { CTASection, TextSection, InfoBox, PageLink, Link } from "@components/index";
+import {
+ CTASection, TextSection, InfoBox, PageLink, Link,
+} from "@components/index";
const KippariImage = styled.img`
max-width:100%;
-`
+`;
const FOPAS_LINK = "";
const FUKSI_POINTS_LINK = "";
@@ -34,10 +36,10 @@ const FreshmenPageView: React.FC = () => (
Orientaatioviikko järjestetään 31.8-4.9, mutta jo ennen sitä sinulla on mahdollisuus tulla tutustumaan meihin, muihin fuksiehin ja ISOihin Varaslähtöön. Varaslähtö fuksivuoteen järjestetään 22.8. Siitä lisää Telegram-ryhmissä ja fuksioppaassa!
Emmaleena
- 0504392855 emmaleena.ahonen (ät) aalto.fi
+ 0504392855 emmaleena.ahonen (ät) aalto.fi
Jonna
- 0504327695 jonna.tammikivi (ät) aalto.fi
+ 0504327695 jonna.tammikivi (ät) aalto.fi
@@ -51,7 +53,7 @@ const FreshmenPageView: React.FC = () => (
Fuksipisteohje
-
+
Telegram?
diff --git a/src/views/FrontPage/FrontPageHero.tsx b/src/views/FrontPage/FrontPageHero.tsx
index a8f2cd5..25699ed 100644
--- a/src/views/FrontPage/FrontPageHero.tsx
+++ b/src/views/FrontPage/FrontPageHero.tsx
@@ -1,6 +1,8 @@
import React from "react";
import { Link } from "@components/index";
-import { Hero, HeroPrimarySection, HeroAside, HeroAsideItem, HeroPrimaryButtons } from "@components/Hero";
+import {
+ Hero, HeroPrimarySection, HeroAside, HeroAsideItem, HeroPrimaryButtons,
+} from "@components/Hero";
import noop from "@utils/noop";
const FrontPageHero: React.FC = () => (
@@ -11,12 +13,12 @@ const FrontPageHero: React.FC = () => (
>
-
+
Tietoa killasta ›
-
+
Vastapainoa opiskelulle ›
@@ -46,4 +48,4 @@ const FrontPageHero: React.FC = () => (
);
-export default FrontPageHero;
\ No newline at end of file
+export default FrontPageHero;
diff --git a/src/views/FrontPage/FrontPageView.tsx b/src/views/FrontPage/FrontPageView.tsx
index 5ef05ab..9737e72 100644
--- a/src/views/FrontPage/FrontPageView.tsx
+++ b/src/views/FrontPage/FrontPageView.tsx
@@ -1,11 +1,18 @@
import React from "react";
import styled from "styled-components";
-import { Card, PageLink, Divider, CardSection, CTASection } from "@components/index";
+import {
+ Card,
+ PageLink,
+ Divider,
+ CardSection,
+ CTASection,
+ Link,
+} from "@components/index";
import FrontPageHero from "./FrontPageHero";
import { Event } from "@models/Event";
import { Post } from "@models/Feed";
import { colors } from "@theme/colors";
-import { Link } from "@components/index";
+
import FullWidthSection from "@components/Sections/FullWidthSection";
import noop from "@utils/noop";
@@ -55,13 +62,12 @@ const SponsorReel = styled.div`
}
`;
-
const FrontPageView: React.FC = ({ events, feed }) => (
<>
- {events.map(event => (
+ {events.map((event) => (
= ({ events, feed }) => (
- {feed.map(inst => (
+ {feed.map((inst) => (
= ({ events, feed }) => (
>
-)
+);
export default FrontPageView;
diff --git a/src/views/GuildPage/GuildPageHero.tsx b/src/views/GuildPage/GuildPageHero.tsx
index 34213bd..ac54ab2 100644
--- a/src/views/GuildPage/GuildPageHero.tsx
+++ b/src/views/GuildPage/GuildPageHero.tsx
@@ -1,6 +1,8 @@
import React from "react";
import { Link } from "@components/index";
-import { Hero, HeroPrimarySection, HeroAside, HeroAsideItem } from "@components/Hero";
+import {
+ Hero, HeroPrimarySection, HeroAside, HeroAsideItem,
+} from "@components/Hero";
const GuildPageHero: React.FC = () => (
@@ -15,18 +17,18 @@ const GuildPageHero: React.FC = () => (
-
+ linkText="Killan hallinnosta ›"
+ />
-
+ linkText="Kiltatoiminnasta ›"
+ />
-
+ linkText="Kiltahuone ja muut palvelut ›"
+ />
);
diff --git a/src/views/GuildPage/GuildPageView.tsx b/src/views/GuildPage/GuildPageView.tsx
index 9871728..da614ac 100644
--- a/src/views/GuildPage/GuildPageView.tsx
+++ b/src/views/GuildPage/GuildPageView.tsx
@@ -1,6 +1,8 @@
import React from "react";
import styled from "styled-components";
-import { CTASection, TextSection, PageLink, Link } from "@components/index";
+import {
+ CTASection, TextSection, PageLink, Link,
+} from "@components/index";
import GuildPageHero from "./GuildPageHero";
import FullWidthSection from "@components/Sections/FullWidthSection";
import colors from "@theme/colors";
@@ -102,7 +104,7 @@ const GuildPageView: React.FC = () => (
Runsaasti erilaisia tehtäviä
Killassa löytyy tehtäviä moneen lähtöön. Olitpa koodaaja, urheilija, kulttuurin ystävä tai ammattimainen juhlija, killasta löytyy tekemistä juuri sinulle. Toimihenkilönä pääset esimerkiksi
-
+
Edistämään opintoja ja abimarkkinointia
Luomaan ja ylläpitämään yrityssuhteita
Järjestämään juhlia ja saunailtoja
@@ -121,8 +123,7 @@ const GuildPageView: React.FC = () => (
Kiltalaisten omia projekteja varten kilta ylläpitää Otakaari 1:ssä sijaitsevaa Elektroniikkapajaa, josta löytyy tarvikkeita, työkaluja ja tilat monenlaisia töitä varten. Jos haluat tutustua tiloihin, ota yhteyttä pajavastaavaan!
>
diff --git a/src/views/InEnglishPage/InEnglishPageHero.tsx b/src/views/InEnglishPage/InEnglishPageHero.tsx
index 5b9eeda..9401e52 100644
--- a/src/views/InEnglishPage/InEnglishPageHero.tsx
+++ b/src/views/InEnglishPage/InEnglishPageHero.tsx
@@ -1,5 +1,7 @@
import React from "react";
-import { Hero, HeroPrimarySection, HeroAside, HeroAsideItem } from "@components/Hero";
+import {
+ Hero, HeroPrimarySection, HeroAside, HeroAsideItem,
+} from "@components/Hero";
const InEnglishPageHero: React.FC = () => (
diff --git a/src/views/SignUpPage/FormUtils.tsx b/src/views/SignUpPage/FormUtils.tsx
index 7636779..488e0e8 100644
--- a/src/views/SignUpPage/FormUtils.tsx
+++ b/src/views/SignUpPage/FormUtils.tsx
@@ -1,4 +1,3 @@
-
import { Question } from "@components/Widgets/SignupQuestionsWidget";
import { SignupForm } from "@models/SignupForm";
import { EMAIL_REGEX } from "@utils/regexes";
@@ -6,20 +5,19 @@ import escapeRegExp from "lodash/escapeRegExp";
const questionToUISchemaProp = (question: Question) => {
let obj: Record<"ui:widget", string>;
- if (question.type == "checkbox") {
+ if (question.type === "checkbox") {
obj = {
"ui:widget": "checkboxes",
};
- }
- else if (question.type == "radiobutton") {
+ } else if (question.type === "radiobutton") {
obj = {
"ui:widget": "radio",
- }
+ };
}
return {
[question.id]: obj,
};
-}
+};
const questionToValidationSchema = (question: Question) => {
let obj: Record;
@@ -28,33 +26,29 @@ const questionToValidationSchema = (question: Question) => {
type: "string",
title: question.name,
};
- }
- else if(question.type === "info") {
+ } else if (question.type === "info") {
obj = {
type: "null",
title: question.name,
- description: question.options
+ description: question.options,
};
- }
- else if (question.type === "email") {
+ } else if (question.type === "email") {
// Format is just a "FYI" field, so we also have pattern.
obj = {
type: question.required ? ["string"] : ["string", "null"],
title: question.name,
format: "email",
pattern: EMAIL_REGEX.source,
- default: null
- }
- }
- else if (question.type === "radiobutton") {
+ default: null,
+ };
+ } else if (question.type === "radiobutton") {
obj = {
type: "string",
title: question.name,
- pattern: question.options.map(x => `^${escapeRegExp(x)}$`).join("|"),
+ pattern: question.options.map((x) => `^${escapeRegExp(x)}$`).join("|"),
enum: question.options,
- }
- }
- else if (question.type === "checkbox") {
+ };
+ } else if (question.type === "checkbox") {
obj = {
type: "array",
title: question.name,
@@ -63,50 +57,45 @@ const questionToValidationSchema = (question: Question) => {
items: {
type: "string",
enum: question.options,
- pattern: question.options.map(x => `^${escapeRegExp(x)}$`).join("|"),
+ pattern: question.options.map((x) => `^${escapeRegExp(x)}$`).join("|"),
},
- }
- }
- // https://json-schema.org/understanding-json-schema/reference/numeric.html
- else if (question.type === "integer") {
+ };
+ } else if (question.type === "integer") {
+ // https://json-schema.org/understanding-json-schema/reference/numeric.html
if (question.options.length === 1) {
obj = {
type: "number",
title: `${question.name} (Max: ${question.options[0]})`,
multipleOf: 1.0,
maximum: Number(question.options[0]),
- }
- }
- else if (question.options.length === 2) {
+ };
+ } else if (question.options.length === 2) {
obj = {
type: "number",
title: `${question.name} (${question.options[0]} -- ${question.options[1]})`,
multipleOf: 1.0,
minimum: Number(question.options[0]),
maximum: Number(question.options[1]),
- }
- }
- else {
+ };
+ } else {
obj = {
type: "number",
title: question.name,
multipleOf: 1.0,
- }
+ };
}
- }
- else {
+ } else {
throw new Error(`No mapping to schema prop for question type ${question.type}`);
-
}
return {
[question.id]: obj,
- }
-}
+ };
+};
export const buildFormSchema = (signUpForm: SignupForm) => {
let schemaProps = {};
- const {questions} = signUpForm;
- const requiredIds = questions.filter(q => q.required).map(q => q.id);
+ const { questions } = signUpForm;
+ const requiredIds = questions.filter((q) => q.required).map((q) => q.id);
const schemaPropsArray = questions.map(questionToValidationSchema);
schemaPropsArray.forEach((schemaProp) => {
schemaProps = {
@@ -123,11 +112,11 @@ export const buildFormSchema = (signUpForm: SignupForm) => {
};
return schema;
-}
+};
export const buildValidationSchema = (questions: Question[]) => {
let schemaProps = {};
- const requiredIds = questions.filter(q => q.required).map(q => q.id);
+ const requiredIds = questions.filter((q) => q.required).map((q) => q.id);
const schemaPropsArray = questions.map(questionToValidationSchema);
schemaPropsArray.forEach((schemaProp) => {
schemaProps = {
@@ -136,18 +125,18 @@ export const buildValidationSchema = (questions: Question[]) => {
};
});
- const validationSchema = {
+ const validationSchema = {
type: "object",
required: requiredIds,
// minProperties: requiredIds.length,
// maxProperties: requiredIds.length,
- properties: schemaProps
- }
+ properties: schemaProps,
+ };
return validationSchema;
-}
+};
export const buildUISchema = (signUpForm: SignupForm) => {
- const {questions} = signUpForm;
+ const { questions } = signUpForm;
const uiSchemaPropsArray = questions.map(questionToUISchemaProp);
let uiSchemaProps = {};
uiSchemaPropsArray.forEach((uiSchemaProp) => {
@@ -161,4 +150,4 @@ export const buildUISchema = (signUpForm: SignupForm) => {
...uiSchemaProps,
};
return uiSchema;
-}
+};
diff --git a/src/views/SignUpPage/SignUpPageView.tsx b/src/views/SignUpPage/SignUpPageView.tsx
index 42fa4b6..e27e1fa 100644
--- a/src/views/SignUpPage/SignUpPageView.tsx
+++ b/src/views/SignUpPage/SignUpPageView.tsx
@@ -10,8 +10,8 @@ import { colors } from "@theme/colors";
import FormWrapper from "@views/common/FormWrapper";
const customWidgets = {
- "radio": RadioButtonWidget,
- "checkboxes": Checkboxes
+ radio: RadioButtonWidget,
+ checkboxes: Checkboxes,
};
interface SignUpPageViewProps {
@@ -22,20 +22,18 @@ interface SignUpPageViewProps {
onSubmit: (e: ISubmitEvent) => any;
}
-const renderList = (signUpForm: SignupForm) => {
- return (
- <>
-
- Ilmoittautuneet{signUpForm.quota > 0 && (` (${signUpForm.signups.length}/${signUpForm.quota})`)}:
-
-
- {signUpForm.signups.map((s, idx) => (
- signUpForm.quota ? "reserved" : ""}>{s}
- ))}
-
- >
- )
-}
+const renderList = (signUpForm: SignupForm) => (
+ <>
+
+ Ilmoittautuneet{signUpForm.quota > 0 && (` (${signUpForm.signups.length}/${signUpForm.quota})`)}:
+
+
+ {signUpForm.signups.map((s, idx) => (
+ signUpForm.quota ? "reserved" : ""}>{s}
+ ))}
+
+ >
+);
const StyledSection = styled(TextSection)`
& > div {
@@ -61,9 +59,8 @@ const SignUpPageView: React.FC = ({
formData,
statusMessage,
onChange,
- onSubmit
+ onSubmit,
}) => {
-
const renderForm = () => {
const schema = buildFormSchema(signUpForm);
const uiSchema = buildUISchema(signUpForm);
@@ -79,7 +76,7 @@ const SignUpPageView: React.FC = ({
onSubmit={onSubmit}
/>
);
- }
+ };
const form = signUpForm ? renderForm() : <>Loading...>;
@@ -104,7 +101,7 @@ const SignUpPageView: React.FC = ({
- )
-}
+ );
+};
export default SignUpPageView;
diff --git a/src/views/StudiesPage/StudiesPageHero.tsx b/src/views/StudiesPage/StudiesPageHero.tsx
index dcc81f9..af424dd 100644
--- a/src/views/StudiesPage/StudiesPageHero.tsx
+++ b/src/views/StudiesPage/StudiesPageHero.tsx
@@ -1,5 +1,7 @@
import React from "react";
-import { Hero, HeroPrimarySection, HeroAside, HeroAsideItem } from "@components/Hero";
+import {
+ Hero, HeroPrimarySection, HeroAside, HeroAsideItem,
+} from "@components/Hero";
const StudiesPageHero: React.FC = () => (
diff --git a/src/views/StudiesPage/StudiesPageView.tsx b/src/views/StudiesPage/StudiesPageView.tsx
index 95ede38..bb63c64 100644
--- a/src/views/StudiesPage/StudiesPageView.tsx
+++ b/src/views/StudiesPage/StudiesPageView.tsx
@@ -1,6 +1,8 @@
import React from "react";
import styled from "styled-components";
-import { CTASection, TextSection, PageLink, Accordion, Link } from "@components/index";
+import {
+ CTASection, TextSection, PageLink, Accordion, Link,
+} from "@components/index";
import StudiesPageHero from "./StudiesPageHero";
// TODO: Responsive
@@ -85,7 +87,6 @@ const StudiesPageView: React.FC = () => (
-
Sähkötekniikan korkeakoulun toimikunnat
@@ -93,12 +94,13 @@ const StudiesPageView: React.FC = () => (
Ylioppilaskunnalla on edustus suuressa osassa Aalto-yliopiston tiedekuntia. Elektroniikan, tietoliikenteen ja automaation tiedekunnan toimikuntiin eli hallopedeihin opiskelijavalinna EST- ja TLT-tutkinto-ohjelmien osalta tehdään osin ylioppilaskunnan edustajistossa Sähköinsinöörikillan esityksestä ja osin Sähköinsinöörikillassa.
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed rhoncus feugiat ante. Nam eget venenatis dui. Morbi purus dui, cursus at velit id, placerat scelerisque turpis. Nulla a mauris odio. Nulla at tempor mi. Maecenas et sapien eu lorem interdum luctus. Proin interdum, tortor eget tempor tristique, massa arcu suscipit ipsum, sit amet lacinia erat lorem sit amet ipsum. Praesent dictum odio auctor odio sodales pharetra. Quisque accumsan iaculis diam, a laoreet odio aliquet eu. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In hac habitasse platea dictumst. Pellentesque at hendrerit mi. Morbi at lacus finibus, pharetra urna sed, molestie tellus. Duis fermentum sodales leo. Nullam varius, massa in convallis sagittis, mi felis lacinia ipsum, viverra rhoncus nibh ipsum vel mi. Pellentesque ornare hendrerit malesuada.
- Suspendisse porta diam in massa suscipit congue. Nulla facilisi. Nulla egestas tempus arcu, vitae ultrices risus rhoncus ac. Ut porta orci neque, vel fermentum turpis fermentum in. Curabitur condimentum, mi in tristique pulvinar, mauris nibh bibendum neque, quis tincidunt purus eros quis dolor. Aliquam imperdiet nibh ac quam iaculis, at ullamcorper diam ultricies. Vestibulum egestas consequat justo non vehicula. Nam non egestas tellus.
- Praesent vel auctor ligula. Phasellus faucibus vulputate erat, non fringilla sem ultrices non. In vitae elit sit amet nisl interdum ultrices nec in ligula. Ut et turpis risus. Sed mattis varius nisl, in euismod diam fringilla ac. Nunc sed eros augue. Donec sit amet quam ex. Integer luctus nulla at est rutrum, a commodo est dapibus. Maecenas sagittis scelerisque blandit. Morbi congue tortor eros, sit amet vestibulum dolor tempor vitae. In pretium tellus at velit porttitor, vitae rutrum lacus suscipit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam bibendum ultricies metus, nec placerat urna efficitur auctor. Morbi non purus magna. Ut at ex nec nunc dictum ultricies.
- Mauris volutpat nec sem sed malesuada. Sed eu scelerisque libero. Phasellus at mauris in ligula congue interdum et sit amet ante. Sed vestibulum, sem non congue molestie, quam massa euismod sem, non porta sem mauris vitae justo. Donec et fringilla tortor. Cras sed purus eget ante elementum mattis. Nunc elit nunc, volutpat sed congue ac, varius a ligula. Aenean sit amet laoreet dolor. Aenean finibus iaculis diam, quis lacinia nisi semper id. Phasellus eu nulla sed risus accumsan finibus. Nulla vel ante id mi vulputate ultrices. Cras finibus elementum tortor, at fringilla arcu facilisis ut. Cras vitae lectus pretium, posuere risus venenatis, congue metus. Phasellus vel dapibus felis.
- Maecenas tincidunt orci nulla. Sed maximus tellus nec lorem dignissim aliquet. Maecenas tincidunt dolor sed est laoreet, nec suscipit augue dictum. Vivamus venenatis rutrum molestie. Vestibulum in maximus leo. Duis a euismod nulla. Aenean luctus sodales quam, ut fringilla elit bibendum in. Ut in purus sit amet libero hendrerit hendrerit ac eget nisl. In ac mauris at felis suscipit scelerisque eu eget erat. Fusce accumsan tempus mauris, porta sagittis odio venenatis ac. Integer mollis nulla in velit dignissim imperdiet. Nunc ac magna ullamcorper, pretium mauris et, semper enim. Morbi aliquet accumsan turpis id rutrum. Donec purus tellus, pellentesque non nunc ac, ornare scelerisque ex.
+ title="Akateeminen komitea"
+ >
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed rhoncus feugiat ante. Nam eget venenatis dui. Morbi purus dui, cursus at velit id, placerat scelerisque turpis. Nulla a mauris odio. Nulla at tempor mi. Maecenas et sapien eu lorem interdum luctus. Proin interdum, tortor eget tempor tristique, massa arcu suscipit ipsum, sit amet lacinia erat lorem sit amet ipsum. Praesent dictum odio auctor odio sodales pharetra. Quisque accumsan iaculis diam, a laoreet odio aliquet eu. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In hac habitasse platea dictumst. Pellentesque at hendrerit mi. Morbi at lacus finibus, pharetra urna sed, molestie tellus. Duis fermentum sodales leo. Nullam varius, massa in convallis sagittis, mi felis lacinia ipsum, viverra rhoncus nibh ipsum vel mi. Pellentesque ornare hendrerit malesuada.
+ Suspendisse porta diam in massa suscipit congue. Nulla facilisi. Nulla egestas tempus arcu, vitae ultrices risus rhoncus ac. Ut porta orci neque, vel fermentum turpis fermentum in. Curabitur condimentum, mi in tristique pulvinar, mauris nibh bibendum neque, quis tincidunt purus eros quis dolor. Aliquam imperdiet nibh ac quam iaculis, at ullamcorper diam ultricies. Vestibulum egestas consequat justo non vehicula. Nam non egestas tellus.
+ Praesent vel auctor ligula. Phasellus faucibus vulputate erat, non fringilla sem ultrices non. In vitae elit sit amet nisl interdum ultrices nec in ligula. Ut et turpis risus. Sed mattis varius nisl, in euismod diam fringilla ac. Nunc sed eros augue. Donec sit amet quam ex. Integer luctus nulla at est rutrum, a commodo est dapibus. Maecenas sagittis scelerisque blandit. Morbi congue tortor eros, sit amet vestibulum dolor tempor vitae. In pretium tellus at velit porttitor, vitae rutrum lacus suscipit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam bibendum ultricies metus, nec placerat urna efficitur auctor. Morbi non purus magna. Ut at ex nec nunc dictum ultricies.
+ Mauris volutpat nec sem sed malesuada. Sed eu scelerisque libero. Phasellus at mauris in ligula congue interdum et sit amet ante. Sed vestibulum, sem non congue molestie, quam massa euismod sem, non porta sem mauris vitae justo. Donec et fringilla tortor. Cras sed purus eget ante elementum mattis. Nunc elit nunc, volutpat sed congue ac, varius a ligula. Aenean sit amet laoreet dolor. Aenean finibus iaculis diam, quis lacinia nisi semper id. Phasellus eu nulla sed risus accumsan finibus. Nulla vel ante id mi vulputate ultrices. Cras finibus elementum tortor, at fringilla arcu facilisis ut. Cras vitae lectus pretium, posuere risus venenatis, congue metus. Phasellus vel dapibus felis.
+ Maecenas tincidunt orci nulla. Sed maximus tellus nec lorem dignissim aliquet. Maecenas tincidunt dolor sed est laoreet, nec suscipit augue dictum. Vivamus venenatis rutrum molestie. Vestibulum in maximus leo. Duis a euismod nulla. Aenean luctus sodales quam, ut fringilla elit bibendum in. Ut in purus sit amet libero hendrerit hendrerit ac eget nisl. In ac mauris at felis suscipit scelerisque eu eget erat. Fusce accumsan tempus mauris, porta sagittis odio venenatis ac. Integer mollis nulla in velit dignissim imperdiet. Nunc ac magna ullamcorper, pretium mauris et, semper enim. Morbi aliquet accumsan turpis id rutrum. Donec purus tellus, pellentesque non nunc ac, ornare scelerisque ex.
diff --git a/src/views/admin/AdminCreateCommon.tsx b/src/views/admin/AdminCreateCommon.tsx
index 222ed45..770d51b 100644
--- a/src/views/admin/AdminCreateCommon.tsx
+++ b/src/views/admin/AdminCreateCommon.tsx
@@ -63,13 +63,12 @@ const AdminCreateCommon: React.FC
= ({
onSubmit,
statusMessage,
error,
- widgets
+ widgets,
}) => {
-
const onError = (data: any) => {
console.error("error, data:");
console.log(data);
- }
+ };
return (
@@ -94,7 +93,7 @@ const AdminCreateCommon: React.FC = ({
)}
- )
-}
+ );
+};
export default AdminCreateCommon;
diff --git a/src/views/admin/AdminListCommon.tsx b/src/views/admin/AdminListCommon.tsx
index d19bd05..5b57170 100644
--- a/src/views/admin/AdminListCommon.tsx
+++ b/src/views/admin/AdminListCommon.tsx
@@ -27,6 +27,6 @@ const AdminListCommon: React.FC = ({ children }) => (
{children}
-)
+);
export default AdminListCommon;
diff --git a/src/views/common/AdminPageWrapper.tsx b/src/views/common/AdminPageWrapper.tsx
index a6412d1..b28e6d0 100644
--- a/src/views/common/AdminPageWrapper.tsx
+++ b/src/views/common/AdminPageWrapper.tsx
@@ -36,7 +36,6 @@ const Main = styled.main`
}
`;
-
const useShouldRedirect = (enabled = true) => {
const [redirecting, setRedirect] = useState(false);
const [completed, setCompleted] = useState(!enabled);
@@ -52,10 +51,9 @@ const useShouldRedirect = (enabled = true) => {
return {
redirecting,
- completed
+ completed,
};
-}
-
+};
type PageProps = {
requiresAuthentication: boolean;
@@ -85,7 +83,7 @@ const AdminPageWrapper: React.FC = ({ requiresAuthentication, childre
{children}
>
- )
-}
+ );
+};
-export default AdminPageWrapper;
\ No newline at end of file
+export default AdminPageWrapper;
diff --git a/src/views/common/FormWrapper.tsx b/src/views/common/FormWrapper.tsx
index 606e490..25d1a70 100644
--- a/src/views/common/FormWrapper.tsx
+++ b/src/views/common/FormWrapper.tsx
@@ -64,4 +64,4 @@ const FormStyleWrapper = styled(Form)`
}
`;
-export default FormStyleWrapper;
\ No newline at end of file
+export default FormStyleWrapper;
diff --git a/src/views/common/PageWrapper.tsx b/src/views/common/PageWrapper.tsx
index e501ca2..3f2db7a 100644
--- a/src/views/common/PageWrapper.tsx
+++ b/src/views/common/PageWrapper.tsx
@@ -8,6 +8,6 @@ const PageWrapper: React.FC = ({ children }) => (
{children}
>
-)
+);
-export default PageWrapper;
\ No newline at end of file
+export default PageWrapper;