Added import sorting to prettier config
continuous-integration/drone/push Build is passing Details

main
Guus van Meerveld 2 years ago
parent 2b4b0d0a39
commit 53f63981c6
Signed by: Guusvanmeerveld
GPG Key ID: 2BA7D7912771966E

@ -1,9 +1,8 @@
import Link from "next/link"; import Link from "next/link";
import { format as formatTimeAgo } from "timeago.js";
import { FC } from "react";
import z from "zod"; import z from "zod";
import { format as formatTimeAgo } from "timeago.js"; import { FC } from "react";
import { RepositoryResponse } from "@models/git/responses"; import { RepositoryResponse } from "@models/git/responses";

@ -1,15 +1,14 @@
import z from "zod"; import Link from "next/link";
import { FC } from "react";
import { format as formatTimeAgo } from "timeago.js"; import { format as formatTimeAgo } from "timeago.js";
import z from "zod";
import Link from "next/link"; import styles from "./repositories.module.scss";
import multipleClassNames from "@utils/multipleClassNames"; import { FC } from "react";
import { RepositoryResponse } from "@models/git/responses"; import { RepositoryResponse } from "@models/git/responses";
import styles from "./repositories.module.scss"; import multipleClassNames from "@utils/multipleClassNames";
const FeaturedRepositories: FC<{ const FeaturedRepositories: FC<{
repositories: z.infer<typeof RepositoryResponse>[]; repositories: z.infer<typeof RepositoryResponse>[];

@ -1,12 +1,12 @@
import { FC } from "react";
import Link from "next/link"; import Link from "next/link";
import multipleClassNames from "@utils/multipleClassNames";
import { giteaServerUrl, giteaUsername } from "@utils/config";
import styles from "./footer.module.scss"; import styles from "./footer.module.scss";
import { FC } from "react";
import { giteaServerUrl, giteaUsername } from "@utils/config";
import multipleClassNames from "@utils/multipleClassNames";
const Footer: FC = () => { const Footer: FC = () => {
return ( return (
<footer className={multipleClassNames("container", styles.main)}> <footer className={multipleClassNames("container", styles.main)}>

@ -1,14 +1,14 @@
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import axios from "axios";
import { FC, FormEvent, useCallback, useState } from "react"; import { FC, FormEvent, useCallback, useState } from "react";
import axios from "axios";
import { LoginCredentials } from "@models/login"; import { LoginCredentials } from "@models/login";
import { Response } from "@models/response"; import { Response } from "@models/response";
import { parseAxiosError, parseAxiosResponse } from "@utils/fetch";
import { parseUserInputError } from "@utils/errors"; import { parseUserInputError } from "@utils/errors";
import { parseAxiosError, parseAxiosResponse } from "@utils/fetch";
const LoginForm: FC = () => { const LoginForm: FC = () => {
const [username, setUsername] = useState(""); const [username, setUsername] = useState("");
@ -87,7 +87,7 @@ const LoginForm: FC = () => {
<i className="form-icon" /> Remember me <i className="form-icon" /> Remember me
</label> </label>
{error !== null && ( {error !== null && (
<div className="toast toast-error"> <div className="toast toast-error mb-2">
<button <button
className="btn btn-clear float-right" className="btn btn-clear float-right"
onClick={() => setError(null)} onClick={() => setError(null)}

@ -1,14 +1,14 @@
import { FC } from "react";
import Link from "next/link"; import Link from "next/link";
import styles from "./post.module.scss";
import { FC } from "react";
import { Post, User } from "@prisma/client"; import { Post, User } from "@prisma/client";
import multipleClassNames from "@utils/multipleClassNames"; import multipleClassNames from "@utils/multipleClassNames";
import styles from "./post.module.scss"; const PostsPage: FC<{
const Post: FC<{
post: Post & { post: Post & {
author: User; author: User;
}; };
@ -51,4 +51,4 @@ const Post: FC<{
); );
}; };
export default Post; export default PostsPage;

@ -1,14 +1,14 @@
import axios from "axios"; import { useRouter } from "next/router";
import { FC, FormEvent, useCallback, useState } from "react"; import { FC, FormEvent, useCallback, useState } from "react";
import { useRouter } from "next/router"; import axios from "axios";
import { SignupCredentials } from "@models/signup";
import { Response } from "@models/response"; import { Response } from "@models/response";
import { SignupCredentials } from "@models/signup";
import { parseAxiosError, parseAxiosResponse } from "@utils/fetch";
import { parseUserInputError } from "@utils/errors"; import { parseUserInputError } from "@utils/errors";
import { parseAxiosError, parseAxiosResponse } from "@utils/fetch";
const SignupForm: FC = () => { const SignupForm: FC = () => {
const [email, setEmail] = useState(""); const [email, setEmail] = useState("");

@ -1,9 +1,9 @@
import { FC, useEffect, useState } from "react";
import { useTheme } from "next-themes"; import { useTheme } from "next-themes";
import styles from "./themeChanger.module.scss"; import styles from "./themeChanger.module.scss";
import { FC, useEffect, useState } from "react";
const ThemeChanger: FC = () => { const ThemeChanger: FC = () => {
const [mounted, setMounted] = useState(false); const [mounted, setMounted] = useState(false);
const { theme, setTheme } = useTheme(); const { theme, setTheme } = useTheme();

@ -1,14 +1,15 @@
import { FC } from "react"; import Image from "next/image";
import z from "zod"; import z from "zod";
import Image from "next/image"; import styles from "./user.module.scss";
import { FC } from "react";
import { UserResponse } from "@models/git/responses"; import { UserResponse } from "@models/git/responses";
import { giteaServerUrl } from "@utils/config"; import { giteaServerUrl } from "@utils/config";
import multipleClassNames from "@utils/multipleClassNames"; import multipleClassNames from "@utils/multipleClassNames";
import styles from "./user.module.scss";
const User: FC<{ isAvailable: boolean; user: z.infer<typeof UserResponse> }> = const User: FC<{ isAvailable: boolean; user: z.infer<typeof UserResponse> }> =
({ isAvailable, user }) => { ({ isAvailable, user }) => {
return ( return (

@ -3,7 +3,6 @@
margin-bottom: 2rem; margin-bottom: 2rem;
} }
.avatar { .avatar {
border-radius: 5px; border-radius: 5px;
} }

@ -1,11 +1,11 @@
import { NextPage } from "next"; import { NextPage } from "next";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import Layout from "@components/Layout"; import styles from "./404.module.scss";
import multipleClassNames from "@utils/multipleClassNames"; import multipleClassNames from "@utils/multipleClassNames";
import styles from "./404.module.scss"; import Layout from "@components/Layout";
const NotFound: NextPage = () => { const NotFound: NextPage = () => {
const router = useRouter(); const router = useRouter();

@ -1,14 +1,12 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import "@styles/globals.scss";
import SEO from "../next-seo.config";
import { DefaultSeo } from "next-seo"; import { DefaultSeo } from "next-seo";
import { ThemeProvider } from "next-themes"; import { ThemeProvider } from "next-themes";
import type { AppProps } from "next/app"; import type { AppProps } from "next/app";
import SEO from "../next-seo.config";
import "@styles/globals.scss";
const queryClient = new QueryClient(); const queryClient = new QueryClient();
const App = ({ Component, pageProps }: AppProps): JSX.Element => ( const App = ({ Component, pageProps }: AppProps): JSX.Element => (

@ -1,14 +1,14 @@
import { NextPage } from "next"; import { NextPage } from "next";
import { NextSeo } from "next-seo"; import { NextSeo } from "next-seo";
import { Post, User } from "@prisma/client"; import styles from "./admin.module.scss";
import Layout from "@components/Layout"; import { Post, User } from "@prisma/client";
import { withSessionSsr } from "@utils/session";
import prisma from "@utils/prisma"; import prisma from "@utils/prisma";
import { withSessionSsr } from "@utils/session";
import styles from "./admin.module.scss"; import Layout from "@components/Layout";
const AdminPage: NextPage<{ const AdminPage: NextPage<{
user: User; user: User;

@ -1,11 +1,11 @@
import { NextApiHandler } from "next"; import { NextApiHandler } from "next";
import { Post } from "@models/post";
import { Response } from "@models/response";
import { methodNotAllowed, unauthorized } from "@utils/errors"; import { methodNotAllowed, unauthorized } from "@utils/errors";
import { withIronSession } from "@utils/session";
import prisma from "@utils/prisma"; import prisma from "@utils/prisma";
import { withIronSession } from "@utils/session";
import { Response } from "@models/response";
import { Post } from "@models/post";
const handle: NextApiHandler<Response> = async (req, res) => { const handle: NextApiHandler<Response> = async (req, res) => {
if (req.method?.toUpperCase() != "POST") { if (req.method?.toUpperCase() != "POST") {

@ -4,9 +4,9 @@ import { NextApiHandler } from "next";
import { LoginCredentials } from "@models/login"; import { LoginCredentials } from "@models/login";
import { Response } from "@models/response"; import { Response } from "@models/response";
import { withIronSession } from "@utils/session";
import { methodNotAllowed, unauthorized } from "@utils/errors"; import { methodNotAllowed, unauthorized } from "@utils/errors";
import prisma from "@utils/prisma"; import prisma from "@utils/prisma";
import { withIronSession } from "@utils/session";
const handle: NextApiHandler<Response> = async (req, res) => { const handle: NextApiHandler<Response> = async (req, res) => {
if (req.method?.toUpperCase() !== "POST") { if (req.method?.toUpperCase() !== "POST") {

@ -1,9 +1,10 @@
import { NextApiHandler } from "next"; import { NextApiHandler } from "next";
import { withIronSession } from "@utils/session";
import { methodNotAllowed, unauthorized } from "@utils/errors";
import { Response } from "@models/response"; import { Response } from "@models/response";
import { methodNotAllowed, unauthorized } from "@utils/errors";
import { withIronSession } from "@utils/session";
const handle: NextApiHandler<Response> = (req, res) => { const handle: NextApiHandler<Response> = (req, res) => {
if (req.method?.toUpperCase() != "GET") { if (req.method?.toUpperCase() != "GET") {
res.status(405).json(methodNotAllowed); res.status(405).json(methodNotAllowed);

@ -1,7 +1,7 @@
import { Response } from "@models/response";
import { NextApiHandler } from "next"; import { NextApiHandler } from "next";
import { Response } from "@models/response";
import { registrationIsEnabled } from "@utils/config"; import { registrationIsEnabled } from "@utils/config";
import { methodNotAllowed } from "@utils/errors"; import { methodNotAllowed } from "@utils/errors";

@ -1,15 +1,13 @@
import bcrypt from "bcrypt"; import bcrypt from "bcrypt";
import { NextApiHandler } from "next"; import { NextApiHandler } from "next";
import prisma from "@utils/prisma";
import { SignupCredentials } from "@models/signup";
import { Response } from "@models/response"; import { Response } from "@models/response";
import { SignupCredentials } from "@models/signup";
import { withIronSession } from "@utils/session";
import { methodNotAllowed } from "@utils/errors";
import { registrationIsEnabled, saltRoundsForPassword } from "@utils/config"; import { registrationIsEnabled, saltRoundsForPassword } from "@utils/config";
import { methodNotAllowed } from "@utils/errors";
import prisma from "@utils/prisma";
import { withIronSession } from "@utils/session";
const handle: NextApiHandler<Response> = async (req, res) => { const handle: NextApiHandler<Response> = async (req, res) => {
if (!registrationIsEnabled) { if (!registrationIsEnabled) {

@ -1,14 +1,14 @@
import { NextSeo } from "next-seo";
import { GetStaticPaths, GetStaticProps, NextPage } from "next"; import { GetStaticPaths, GetStaticProps, NextPage } from "next";
import { NextSeo } from "next-seo";
import { Post, User } from "@prisma/client"; import styles from "./[id].module.scss";
import Layout from "@components/Layout"; import { Post, User } from "@prisma/client";
import Tags from "@components/Tags";
import prisma from "@utils/prisma"; import prisma from "@utils/prisma";
import styles from "./[id].module.scss"; import Layout from "@components/Layout";
import Tags from "@components/Tags";
const PostPage: NextPage<{ const PostPage: NextPage<{
post: Post & { post: Post & {

@ -1,5 +1,4 @@
.body { .body {
padding: 10rem 1rem; padding: 10rem 1rem;
@media (max-width: 840px) { @media (max-width: 840px) {

@ -1,16 +1,15 @@
import { GetStaticProps, NextPage } from "next"; import { GetStaticProps, NextPage } from "next";
import { NextSeo } from "next-seo"; import { NextSeo } from "next-seo";
import { Post, User } from "@prisma/client"; import styles from "./blog.module.scss";
import Layout from "@components/Layout"; import { Post, User } from "@prisma/client";
import prisma from "@utils/prisma"; import prisma from "@utils/prisma";
import Layout from "@components/Layout";
import PostComponent from "@components/Post"; import PostComponent from "@components/Post";
import styles from "./blog.module.scss";
const Blog: NextPage<{ const Blog: NextPage<{
posts: (Post & { posts: (Post & {
author: User; author: User;

@ -1,23 +1,23 @@
import axios from "axios";
import { FormEvent, useCallback, useState } from "react";
import { NextPage } from "next"; import { NextPage } from "next";
import { NextSeo } from "next-seo"; import { NextSeo } from "next-seo";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { User } from "@prisma/client"; import styles from "./new.module.scss";
import Layout from "@components/Layout"; import { FormEvent, useCallback, useState } from "react";
import { withSessionSsr } from "@utils/session"; import axios from "axios";
import { parseAxiosError, parseAxiosResponse } from "@utils/fetch";
import { parseUserInputError } from "@utils/errors"; import { User } from "@prisma/client";
import { Post } from "@models/post"; import { Post } from "@models/post";
import { Response } from "@models/response"; import { Response } from "@models/response";
import styles from "./new.module.scss"; import { parseUserInputError } from "@utils/errors";
import { parseAxiosError, parseAxiosResponse } from "@utils/fetch";
import { withSessionSsr } from "@utils/session";
import Layout from "@components/Layout";
const NewPostPage: NextPage<{ user: User }> = ({ user }) => { const NewPostPage: NextPage<{ user: User }> = ({ user }) => {
const [title, setTitle] = useState(""); const [title, setTitle] = useState("");

@ -1,22 +1,20 @@
import z from "zod";
import { NextSeo } from "next-seo";
import { GetStaticProps, InferGetStaticPropsType, NextPage } from "next"; import { GetStaticProps, InferGetStaticPropsType, NextPage } from "next";
import { NextSeo } from "next-seo";
import User from "@components/User"; import z from "zod";
import Layout from "@components/Layout";
import FeaturedRepositories from "@components/FeaturedRepositories";
import BestRepository from "@components/BestRepository";
import { RepositoryResponse } from "@models/git/responses"; import { RepositoryResponse } from "@models/git/responses";
import { giteaUsername } from "@utils/config";
import { import {
fetchAvailability, fetchAvailability,
fetchRepositories, fetchRepositories,
fetchUser fetchUser
} from "@utils/git/fetch"; } from "@utils/git/fetch";
import { giteaUsername } from "@utils/config";
import BestRepository from "@components/BestRepository";
import FeaturedRepositories from "@components/FeaturedRepositories";
import Layout from "@components/Layout";
import User from "@components/User";
export const getStaticProps: GetStaticProps = async () => { export const getStaticProps: GetStaticProps = async () => {
const isAvailable = await fetchAvailability(); const isAvailable = await fetchAvailability();

@ -17,5 +17,5 @@
} }
.signupButton { .signupButton {
margin-top: .5rem; margin-top: 0.5rem;
} }

@ -1,19 +1,16 @@
import z from "zod";
import axios from "axios";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { NextPage } from "next"; import { NextPage } from "next";
import { NextSeo } from "next-seo"; import { NextSeo } from "next-seo";
import z from "zod";
import Layout from "@components/Layout"; import styles from "./login.module.scss";
import multipleClassNames from "@utils/multipleClassNames"; import axios from "axios";
import { parseAxiosError, parseAxiosResponse } from "@utils/fetch";
import styles from "./login.module.scss"; import { parseAxiosError, parseAxiosResponse } from "@utils/fetch";
import multipleClassNames from "@utils/multipleClassNames";
import Layout from "@components/Layout";
import LoginForm from "@components/LoginForm"; import LoginForm from "@components/LoginForm";
import SignupForm from "@components/SignupForm"; import SignupForm from "@components/SignupForm";

@ -1,5 +1,4 @@
[data-theme="dark"] { [data-theme="dark"] {
body { body {
background-color: $bg-dark; background-color: $bg-dark;
color: $text-primary; color: $text-primary;
@ -44,7 +43,6 @@
} }
.table { .table {
td, td,
th { th {
border-color: lighten($bg-dark-secondary, 10%); border-color: lighten($bg-dark-secondary, 10%);
@ -53,7 +51,7 @@
.table tbody tr.active, .table tbody tr.active,
.table.table-striped tbody tr.active { .table.table-striped tbody tr.active {
background: $bg-dark-secondary background: $bg-dark-secondary;
} }
a:hover { a:hover {
@ -103,6 +101,4 @@
border-color: $primary-color-dark; border-color: $primary-color-dark;
} }
} }
} }

@ -1,7 +1,6 @@
import axios from "axios";
import z from "zod"; import z from "zod";
import createConfigCatClient from "@utils/createConfigCatClient"; import axios from "axios";
import { import {
RepositoryResponse, RepositoryResponse,
@ -10,6 +9,7 @@ import {
} from "@models/git/responses"; } from "@models/git/responses";
import { giteaServerUrl } from "@utils/config"; import { giteaServerUrl } from "@utils/config";
import createConfigCatClient from "@utils/createConfigCatClient";
const apiUrl = `https://${giteaServerUrl}/api/v1`; const apiUrl = `https://${giteaServerUrl}/api/v1`;

@ -5,10 +5,10 @@ import {
NextApiHandler NextApiHandler
} from "next"; } from "next";
import { User } from "@prisma/client";
import { sessionOptions } from "./config"; import { sessionOptions } from "./config";
import { User } from "@prisma/client";
export const withIronSession = (handler: NextApiHandler) => export const withIronSession = (handler: NextApiHandler) =>
withIronSessionApiRoute(handler, sessionOptions); withIronSessionApiRoute(handler, sessionOptions);

Loading…
Cancel
Save