diff --git a/.eslintrc.json b/.eslintrc.json index 8cf105d..ad3c072 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -53,8 +53,6 @@ "react/no-array-index-key": "off", "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/explicit-module-boundary-types": "off", - "jsx-a11y/alt-text": "off", - "jsx-a11y/iframe-has-title": "off", "jsx-a11y/label-has-associated-control": "off", "jsx-a11y/click-events-have-key-events": "off", "jsx-a11y/no-noninteractive-element-interactions": "off", diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c243d1d..cee8250 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -108,7 +108,7 @@ deploy:dev: - master environment: name: dev - url: dev.sahkoinsinoorikilta.fi + url: https://dev.sahkoinsinoorikilta.fi variables: DOCKER_HOST: $DEV_CI_DOCKER_HOST DOCKER_TLS_VERIFY: 1 @@ -130,7 +130,7 @@ deploy:prod: - production environment: name: production - url: sahkoinsinoorikilta.fi + url: https://sahkoinsinoorikilta.fi when: manual variables: DOCKER_HOST: $CI_DOCKER_HOST diff --git a/src/api/eventApi.ts b/src/api/eventApi.ts index 86fdaa4..83cdc55 100644 --- a/src/api/eventApi.ts +++ b/src/api/eventApi.ts @@ -8,6 +8,7 @@ export const URL = `${process.env.NEXT_PUBLIC_API_URL}/events/`; export interface Options { onlyNonPast?: boolean; limit?: number; + offset?: number; auth?: boolean; } @@ -26,11 +27,14 @@ class EventApi { } static async getEvents(options: Options = {}): Promise { - const { onlyNonPast, limit, auth } = options; + const { + onlyNonPast, limit, offset, auth, + } = options; try { const params = { since: onlyNonPast ? (new Date()).toISOString() : undefined, limit, + offset, }; const headers = auth ? { Authorization: getAuthHeader() } : null; const resp = await axios.get(`${URL}`, { diff --git a/src/api/feedApi.ts b/src/api/feedApi.ts index 759462e..2f00aa2 100644 --- a/src/api/feedApi.ts +++ b/src/api/feedApi.ts @@ -6,15 +6,23 @@ import { getAuthHeader } from "@utils/auth"; export const URL = `${process.env.NEXT_PUBLIC_API_URL}/feed/`; export interface Options { + limit?: number; + offset?: number; auth?: boolean; } class FeedApi { static async getFeed(options: Options = {}): Promise { - const { auth } = options; + const { + limit, offset, auth, + } = options; + const params = { + limit, + offset, + }; const headers = auth ? { Authorization: getAuthHeader() } : null; try { - const resp = await axios.get(URL, { headers }); + const resp = await axios.get(URL, { params, headers }); return resp.data.results; } catch (err) { console.error(err); diff --git a/src/api/jobAdApi.ts b/src/api/jobAdApi.ts index a26c28d..eb36d25 100644 --- a/src/api/jobAdApi.ts +++ b/src/api/jobAdApi.ts @@ -8,16 +8,20 @@ export const URL = `${process.env.NEXT_PUBLIC_API_URL}/jobads/`; export interface Options { onlyNonPast?: boolean; limit?: number; + offset?: number; auth?: boolean; } class JobAdApi { static async getJobAds(options: Options = {}): Promise { - const { onlyNonPast, limit, auth } = options; + const { + onlyNonPast, limit, offset, auth, + } = options; try { const params = { since: onlyNonPast ? (new Date()).toISOString() : undefined, limit, + offset, }; const headers = auth ? { Authorization: getAuthHeader() } : null; const resp = await axios.get(`${URL}`, { diff --git a/src/api/signupApi.ts b/src/api/signupApi.ts index fa57f44..6b36509 100644 --- a/src/api/signupApi.ts +++ b/src/api/signupApi.ts @@ -6,10 +6,12 @@ import { getAuthHeader } from "@utils/auth"; export const URL = `${process.env.NEXT_PUBLIC_API_URL}/signup/`; export const FORM_URL = `${process.env.NEXT_PUBLIC_API_URL}/signupForm/`; +// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface Options { - onlyNonPast?: boolean; - limit?: number; - auth?: boolean; + // onlyNonPast?: boolean; + // limit?: number; + // offset?: number; + // auth?: boolean; } class SignupApi { diff --git a/src/api/tagApi.ts b/src/api/tagApi.ts index 8ec4f4c..df41d10 100644 --- a/src/api/tagApi.ts +++ b/src/api/tagApi.ts @@ -4,10 +4,11 @@ import Tag from "@models/Tag"; export const URL = `${process.env.NEXT_PUBLIC_API_URL}/tags/`; +// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface Options { - onlyNonPast?: boolean; - limit?: number; - auth?: boolean; + // limit?: number; + // offset?: number; + // auth?: boolean; } class TagApi { diff --git a/src/components/Card.tsx b/src/components/Card.tsx index a23c86c..3b2c6ad 100644 --- a/src/components/Card.tsx +++ b/src/components/Card.tsx @@ -7,12 +7,15 @@ import breakpoints from "@theme/breakpoints"; interface WrappedCardProps { title: string; - start_time: string; + startTime: string; text: string; link: string; - image?: string; - imageAlt?: string; + image?: { + src: string; + alt: string; + }; buttonOnClick?: () => void; + buttonText?: string; } const StyledCard = styled.article` @@ -67,37 +70,21 @@ const StyledCard = styled.article` `; const WrappedCard: React.FC = ({ - title, text, link, image, imageAlt, start_time, buttonOnClick, ...props -}) => { - const options: Intl.DateTimeFormatOptions = { - day: "numeric", - month: "numeric", - year: "numeric", - hour: "numeric", - minute: "2-digit", - }; - const datetime = new Date(start_time).toLocaleString("fi-FI", options); - const img = image ? ( - {imageAlt} - ) : null; - - const button = ( + title, text, link, image, startTime, buttonOnClick, buttonText, ...props +}) => ( + + {image && ( + {image.alt} + )} +

{startTime}

+

{title}

+

{text}

- ); - - return ( - - {img} -

{datetime}

-

{title}

-

{text}

- {button} -
- ); -}; +
+); export default WrappedCard; diff --git a/src/components/ChangeLanguageButton.tsx b/src/components/ChangeLanguageButton.tsx new file mode 100644 index 0000000..4a49483 --- /dev/null +++ b/src/components/ChangeLanguageButton.tsx @@ -0,0 +1,27 @@ +import React from "react"; +import styled from "styled-components"; +import { useTranslation } from "../i18n"; +import Icon, { IconType } from "./Icon"; + +const ChangeLanguageButton: React.FC = (props) => { + const { i18n } = useTranslation(); + const { language, changeLanguage } = i18n; + return ( + + ); +}; + +export default styled(ChangeLanguageButton)` + font-size: 4rem; + background: none; + border: none; + width: fit-content; +`; diff --git a/src/components/DropDownBox.tsx b/src/components/DropDownBox.tsx index 3a6425a..8af3658 100644 --- a/src/components/DropDownBox.tsx +++ b/src/components/DropDownBox.tsx @@ -10,6 +10,7 @@ interface DropDownBoxProps { const Box = styled.div` background-color: ${colors.white}; + border: 1px solid ${colors.black}; margin-top: 0.8rem; position: absolute; left: 0; diff --git a/src/components/Footer/FooterContent.tsx b/src/components/Footer/FooterContent.tsx index bce1497..9ed71b4 100644 --- a/src/components/Footer/FooterContent.tsx +++ b/src/components/Footer/FooterContent.tsx @@ -93,6 +93,7 @@ const FooterContent: React.FC = () => (