Skip to content

Commit

Permalink
Merge pull request #74 from TurunWappuradio/chore/import-sort
Browse files Browse the repository at this point in the history
Chore: (ehdotus) Järjestetään importit automaattisesti
  • Loading branch information
niemisami authored Mar 23, 2024
2 parents edcb593 + 535b71f commit 51f03e8
Show file tree
Hide file tree
Showing 37 changed files with 150 additions and 99 deletions.
21 changes: 20 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
{
"extends": ["next", "prettier"],
"plugins": ["simple-import-sort"],
"rules": {
"semi": 2
"semi": 2,
"simple-import-sort/imports": [
2,
{
"groups": [
[
"^\\u0000", // Side effect imports.
"^react.*",
"^next.*",
"^node:",
"^@?\\w" // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
],
[
"^", // Absolute imports and other imports such as `@/foo`. Anything not matched in another group.
"^\\." // Anything that starts with a dot.
]
]
}
]
}
}
6 changes: 5 additions & 1 deletion archiver/archive.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { Show, Showlist, showsToGroups } from 'scripts/google/showlistHelpers';
import {
Show,
Showlist,
showsToGroups,
} from '@/scripts/google/showlistHelpers';

const showlistBaseUrl = process.env.ARCHIVE_SOURCE_URL;
const emptyResponse = { showsByDate: [], weekKeys: {} } as const;
Expand Down
6 changes: 3 additions & 3 deletions archiver/archiveCrawlers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { parseSheetToShowList } from 'scripts/google/client';
import { GoogleConfigSheets, getSheet } from 'scripts/google/google';
import { mkdirSync } from 'node:fs';
import fs from 'node:fs/promises';
import path from 'node:path';
import { getImagePath } from 'utils/fileHelpers';

import { parseSheetToShowList } from '@/scripts/google/client';
import { getSheet, GoogleConfigSheets } from '@/scripts/google/google';

export const archiveOldShowlists = async () => {
// NOTE: Uncomment for archiving google sheet data
Expand Down
1 change: 1 addition & 0 deletions components/ShoutBox/messageformatter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';

import NameFormatter from './nameformatter';

interface MessageFormatterProps {
Expand Down
1 change: 1 addition & 0 deletions components/ShoutBox/messageinput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { ChangeEvent, Component, useEffect, useState } from 'react';
import { AiOutlineSend } from 'react-icons/ai';

import NameFormatter from './nameformatter';
import TextField from './textfield';

Expand Down
2 changes: 1 addition & 1 deletion components/ShoutBox/nameformatter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { format } from 'date-fns';
import React from 'react';
import Image from 'next/image';
import { format } from 'date-fns';

interface NameFormatterProps {
name: string;
Expand Down
1 change: 1 addition & 0 deletions components/ShoutBox/nameinput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ChangeEvent, useState } from 'react';

import TextField from './textfield';

const isButtonDisabled = (name: string) => name === '';
Expand Down
6 changes: 3 additions & 3 deletions components/ShoutBox/shoutbox.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState, useEffect, useRef } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import { GrFormClose } from 'react-icons/gr';

import useShoutBoxAndVideo from '../../hooks/useShoutboxAndVideo';
import MessageFormatter from './messageformatter';
import MessageInput from './messageinput';
import NameInput from './nameinput';
import MessageFormatter from './messageformatter';
import useShoutBoxAndVideo from '../../hooks/useShoutboxAndVideo';

const wsURL = process.env.NEXT_PUBLIC_SHOUTBOX_SOURCE || 'ws://localhost:3030';

Expand Down
2 changes: 1 addition & 1 deletion components/button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Link from 'next/link';
import { FC, ReactNode } from 'react';
import Link from 'next/link';

const buttonStyle =
'bg-teal px-6 md:px-8 py-2 md:py-3 text-blue font-bold hover:bg-coral transition ease-in-out rounded';
Expand Down
4 changes: 2 additions & 2 deletions components/calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useState, useEffect } from 'react';
import { startOfDay, format, parseISO, isSameDay } from 'date-fns';
import { FC, useEffect, useState } from 'react';
import { format, isSameDay, parseISO, startOfDay } from 'date-fns';
import fi from 'date-fns/locale/fi';

// Fetch next events but not more than 6 months from now
Expand Down
2 changes: 1 addition & 1 deletion components/controls.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FiPlay, FiPause, FiVolumeX, FiVolume2 } from 'react-icons/fi';
import { FiPause, FiPlay, FiVolume2, FiVolumeX } from 'react-icons/fi';

import VolumeSlider from './volumeSlider';

Expand Down
10 changes: 5 additions & 5 deletions components/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Image from 'next/image';
import Link from 'next/link';
import {
AiOutlineInstagram,
AiFillFacebook,
AiOutlineMail,
AiFillGithub,
AiOutlineInstagram,
AiOutlineMail,
} from 'react-icons/ai';
import { FaDiscord, FaTelegramPlane } from 'react-icons/fa';
import Image from 'next/image';
import Link from 'next/link';

import { NavigationItem } from 'contentful/client';
import { NavigationItem } from '@/contentful/client';

interface FooterProps {
navigationItems: NavigationItem[];
Expand Down
8 changes: 4 additions & 4 deletions components/hero.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { FC, useState } from 'react';
import Image from 'next/image';
import Link from 'next/link';
import { FC, useState } from 'react';

import { contentfulImageLoader } from 'contentful/contentfulImageLoader';
import { LinkButton } from './button';
import { NavigationItem } from 'contentful/client';
import { NavigationItem } from '@/contentful/client';
import { contentfulImageLoader } from '@/contentful/contentfulImageLoader';
import heroImage from '../public/hero.webp';
import { LinkButton } from './button';
import Hamburger from './hamburger/hamburger';
import Menu from './menu';

Expand Down
2 changes: 1 addition & 1 deletion components/menu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from 'next/link';

import { NavigationItem } from 'contentful/client';
import { NavigationItem } from '@/contentful/client';

interface MenuProps {
navigationItems: NavigationItem[];
Expand Down
10 changes: 5 additions & 5 deletions components/player.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Image from 'next/image';
import { useEffect, useState } from 'react';
import { FiMessageSquare, FiPause, FiPlay, FiVideo } from 'react-icons/fi';
import Image from 'next/image';
import { format } from 'date-fns';

import testcard from '../public/testcard.webp';
import useShoutBoxAndVideo from '@/hooks/useShoutboxAndVideo';
import { Show } from '@/scripts/google/showlistHelpers';
import placeholderImage from '../public/kuva_puuttuu_v2.jpeg';
import useShoutBoxAndVideo from 'hooks/useShoutboxAndVideo';
import { FiPause, FiPlay, FiMessageSquare, FiVideo } from 'react-icons/fi';
import { Show } from 'scripts/google/showlistHelpers';
import testcard from '../public/testcard.webp';

const SHOW_REFRESH_TIME = 10000; // 10 seconds

Expand Down
2 changes: 1 addition & 1 deletion components/playerControlPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import useMetadata from 'hooks/useMetadata';
import useMetadata from '@/hooks/useMetadata';
import Controls from './controls';

interface PlayerControlPanelProps {
Expand Down
8 changes: 4 additions & 4 deletions components/responsiveShowlist.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { format, parse } from 'date-fns';
import fi from 'date-fns/locale/fi';
import { Dispatch, SetStateAction, useState } from 'react';
import { BsArrowLeft, BsArrowRight } from 'react-icons/bs';
import { format, parse } from 'date-fns';
import fi from 'date-fns/locale/fi';

import { ShowCard } from 'components/showcard';
import { Show } from 'scripts/google/showlistHelpers';
import { ShowCard } from '@/components/showcard';
import { Show } from '@/scripts/google/showlistHelpers';

interface NavButton {
value: string | null;
Expand Down
4 changes: 2 additions & 2 deletions components/richtext.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { FC } from 'react';
import { MARKS, BLOCKS, INLINES } from '@contentful/rich-text-types';
import Image from 'next/image';
import {
documentToReactComponents,
Options,
} from '@contentful/rich-text-react-renderer';
import Image from 'next/image';
import { BLOCKS, INLINES, MARKS } from '@contentful/rich-text-types';

import { contentfulImageLoader } from '../contentful/contentfulImageLoader';
import { LinkButton } from './button';
Expand Down
6 changes: 3 additions & 3 deletions components/showcard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useState } from 'react';
import Image from 'next/image';
import { format } from 'date-fns';
import fi from 'date-fns/locale/fi';
import Image from 'next/image';
import { useState } from 'react';

import { Show } from '@/scripts/google/showlistHelpers';
import placeholderImage from '../public/kuva_puuttuu_v2.jpeg';
import { Show } from 'scripts/google/showlistHelpers';

interface ShowCard {
show: Show;
Expand Down
6 changes: 3 additions & 3 deletions components/showlist.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useState } from 'react';

import { Show } from 'scripts/google/showlistHelpers';
import { useViewport } from '@/hooks/useViewport';
import { Show } from '@/scripts/google/showlistHelpers';
import { ModeButton } from './button';
import ResponsiveShowlist from './responsiveShowlist';
import ShowlistMap from './showlistMap';
import { ModeButton } from './button';
import { useViewport } from 'hooks/useViewport';

interface ShowlistProps {
showsByDate: {
Expand Down
2 changes: 1 addition & 1 deletion components/showlistMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { differenceInMinutes, format, parse } from 'date-fns';
import fi from 'date-fns/locale/fi';
import { head, keys } from 'ramda';

import { Show } from 'scripts/google/showlistHelpers';
import { Show } from '@/scripts/google/showlistHelpers';
import { ModeButton } from './button';
import { ShowCard } from './showcard';
import { WideScreencard } from './widescreen-card';
Expand Down
3 changes: 2 additions & 1 deletion components/videoPlayer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import useShoutBoxAndVideo from 'hooks/useShoutboxAndVideo';
import { GrFormClose } from 'react-icons/gr';

import useShoutBoxAndVideo from '@/hooks/useShoutboxAndVideo';

const VideoPlayer = () => {
const { videoOpen, setVideoOpen } = useShoutBoxAndVideo();

Expand Down
2 changes: 1 addition & 1 deletion components/widescreen-card.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color } from 'scripts/google/showlistHelpers';
import { Color } from '@/scripts/google/showlistHelpers';

interface WideScreenCardProps {
text: string;
Expand Down
1 change: 1 addition & 0 deletions contentful/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
InMemoryCache,
NormalizedCacheObject,
} from '@apollo/client';

import {
NavigationItemsDocument,
NavigationItemsQuery,
Expand Down
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"eslint": "^8.9.0",
"eslint-config-next": "^12.0.10",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-simple-import-sort": "^12.0.0",
"graphql-let": "^0.18.4",
"postcss": "^8.4.6",
"prettier": "^2.5.1",
Expand Down
18 changes: 9 additions & 9 deletions pages/[...slug].tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { GetStaticPaths, GetStaticProps, NextPage } from 'next';
import Head from 'next/head';

import Footer from '@/components/footer';
import Hero from '@/components/hero';
import RichText from '@/components/richtext';
import {
fetchContent,
fetchNavigationItems,
NavigationItem,
} from 'contentful/client';
import RichText from 'components/richtext';
import {
ContentPagePathsDocument,
ContentPagePathsQuery,
} from 'contentful/graphql/contentPagePaths.graphql';
} from '@/contentful/client';
import {
ContentPageDocument,
ContentPageQuery,
} from 'contentful/graphql/contentPage.graphql';
import Hero from 'components/hero';
import Footer from 'components/footer';
} from '@/contentful/graphql/contentPage.graphql';
import {
ContentPagePathsDocument,
ContentPagePathsQuery,
} from '@/contentful/graphql/contentPagePaths.graphql';

interface ContentPageProps {
name: string;
Expand Down
10 changes: 5 additions & 5 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'tailwindcss/tailwind.css';
import { createRef, useState } from 'react';
import { AppProps } from 'next/app';
import 'tailwindcss/tailwind.css';

import PlayerControlPanel from 'components/playerControlPanel';
import { ShoutBoxAndVideoProvider } from 'hooks/useShoutboxAndVideo';
import { ChatWrapper } from 'components/ShoutBox/shoutbox';
import VideoPlayer from 'components/videoPlayer';
import PlayerControlPanel from '@/components/playerControlPanel';
import { ChatWrapper } from '@/components/ShoutBox/shoutbox';
import VideoPlayer from '@/components/videoPlayer';
import { ShoutBoxAndVideoProvider } from '@/hooks/useShoutboxAndVideo';

const AUDIO_STREAM_URL = 'https://player.turunwappuradio.com/wappuradio.mp3';

Expand Down
2 changes: 1 addition & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Document, { Html, Head, Main, NextScript } from 'next/document';
import Document, { Head, Html, Main, NextScript } from 'next/document';

// A custom Document for Next.js to inject Tailwind styles to the body.
class MyDocument extends Document {
Expand Down
3 changes: 2 additions & 1 deletion pages/api/archiver.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { archiveOldShowlists } from 'archiver/archiveCrawlers';
import type { NextApiRequest, NextApiResponse } from 'next';

import { archiveOldShowlists } from '@/archiver/archiveCrawlers';

type ResponseData = {
message: string;
};
Expand Down
Loading

0 comments on commit 51f03e8

Please sign in to comment.