Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
22a97c0
feat: add configuration
mamont79 Aug 19, 2024
f704248
fix: fix configs for tailwind
mamont79 Aug 21, 2024
5e2425e
Merge pull request #2 from mamont79/welcome-page
mamont79 Aug 21, 2024
a5e9188
feat: add structure to main page
mamont79 Aug 21, 2024
6955bcd
feat: add rss logo to footer
mamont79 Aug 21, 2024
0bee651
config: add colors to tailwind
ordinaraviro Aug 22, 2024
c70fa42
feat: add popup for authors
mamont79 Aug 22, 2024
a834278
feat: add styles, img for authors popup
mamont79 Aug 23, 2024
69bdc66
Merge pull request #5 from mamont79/welcome-page
mamont79 Aug 23, 2024
8060064
feat: add auth routes
ordinaraviro Aug 23, 2024
4e9da89
feat: add auth routes
ordinaraviro Aug 23, 2024
fcff990
feat: add not found page
mamont79 Aug 23, 2024
ada9c38
feat: add new favicon
mamont79 Aug 23, 2024
8b25f66
feat: add errorboundary and toastyfy
mamont79 Aug 23, 2024
64a1166
config: add firebase config
ordinaraviro Aug 24, 2024
a9b669e
feat: add login form
ordinaraviro Aug 24, 2024
333e1ba
feat: add i18n multilanguage
mamont79 Aug 25, 2024
507ddf7
feat: add register form
ordinaraviro Aug 24, 2024
238c545
feat: add auth funcs
ordinaraviro Aug 26, 2024
cf89b26
feat: add auth context
ordinaraviro Aug 26, 2024
953a542
fix: rename favicon.ico to icon.ico and fix it
mamont79 Aug 26, 2024
f7b61fb
fix: fix not-found page
mamont79 Aug 26, 2024
d47eaa8
Merge pull request #9 from mamont79/multiple-lang
ElizabethVasilenko13 Aug 27, 2024
41a1b26
feat: add stricky header behaviour
ElizabethVasilenko13 Aug 27, 2024
5b908cd
feat: add btn tailwind config, add auth btns
ElizabethVasilenko13 Aug 27, 2024
b7b670e
chore: change footer styles
ElizabethVasilenko13 Aug 27, 2024
bd38a20
feat: add welcome btns
ordinaraviro Aug 28, 2024
4be0e93
feat: add login expire
ordinaraviro Aug 28, 2024
a048dc7
Merge branch 'develop' into authentication
ordinaraviro Aug 28, 2024
ccc2d9e
fix: merge conflicts
ordinaraviro Aug 28, 2024
2caaf19
Merge branch 'header-&-button' into authentication
ordinaraviro Aug 28, 2024
4af308f
chore: add translation
ElizabethVasilenko13 Aug 28, 2024
39e519f
Merge pull request #10 from mamont79/header-&-button
ElizabethVasilenko13 Aug 28, 2024
ec15162
refactor: change header and footer container/justify
ElizabethVasilenko13 Aug 28, 2024
ee9542a
refactor: refactor layout
ElizabethVasilenko13 Aug 28, 2024
658f784
fix: input mail pattern
ordinaraviro Aug 28, 2024
577af7b
Merge branch 'develop' into authentication
ordinaraviro Aug 28, 2024
005d82e
feat: add pages navigation and update styles
ElizabethVasilenko13 Aug 28, 2024
10d3e3b
feat: add main page btn
ordinaraviro Aug 28, 2024
222c8db
feat: add form translation
ordinaraviro Aug 28, 2024
6245d37
fix: form error message
ordinaraviro Aug 28, 2024
003d019
feat: add vitest + not found page test
mamont79 Aug 28, 2024
23d8d47
fix: fix issue - cjs build of vite's is deprecated
mamont79 Aug 28, 2024
3eec8d7
Merge pull request #12 from mamont79/authentication
ordinaraviro Aug 29, 2024
10c61c3
Merge branch 'develop' into rest-control-panel
ElizabethVasilenko13 Aug 29, 2024
afe8d30
chore: change btn color and fix ts user name error
ElizabethVasilenko13 Aug 29, 2024
cd00cbc
refactor: fix layout
ElizabethVasilenko13 Aug 29, 2024
d58bcf8
Merge branch 'develop' into vitest
mamont79 Aug 29, 2024
e3f97a7
Merge pull request #13 from mamont79/vitest
mamont79 Aug 29, 2024
79f146e
fix: hot fix of test and config
mamont79 Aug 29, 2024
73d96d0
fix: package-lock.json
mamont79 Aug 30, 2024
66262b9
Merge pull request #14 from mamont79/rest-control-panel
ElizabethVasilenko13 Aug 30, 2024
3d77405
feat: add form tests
ordinaraviro Sep 2, 2024
fa139d2
feat: add language switcher tests
ordinaraviro Sep 2, 2024
78f0186
feat: add header tests
ordinaraviro Sep 2, 2024
f124e0a
feat: add footer tests
ordinaraviro Sep 2, 2024
a62fc4c
feat: add context tests
ordinaraviro Sep 2, 2024
007f8b6
Merge pull request #33 from mamont79/auth-tests
ordinaraviro Sep 5, 2024
b979c9a
refactor: change i18n config andd middleware
mamont79 Sep 9, 2024
da0e058
feat: add tests for authors and boundary
mamont79 Sep 9, 2024
93dd2b9
feat: add test for ...rest/page
mamont79 Sep 9, 2024
c372386
Merge pull request #34 from mamont79/i18n-fix
mamont79 Sep 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"plugins": [
"prettier",
"@typescript-eslint",
"react",
"eslint-plugin-react",
"@next/eslint-plugin-next"
],
"extends": [
"next/core-web-vitals",
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:react/jsx-runtime",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"project": "**/tsconfig.json",
"tsconfigRootDir": "__dirname"
},
"env": {
"es6": true,
"browser": true,
"node": true
},
"rules": {
"@typescript-eslint/no-explicit-any": "error"
}
}
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run coverage
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"printWidth": 90,
"trailingComma": "es5",
"endOfLine": "auto",
"tabWidth": 2,
"singleQuote": true,
"semi": true,
"arrowParens": "always"
}
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
# graphiql-app
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
16 changes: 16 additions & 0 deletions app/[locale]/[...rest]/page.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { render } from '@testing-library/react';
import { vi } from 'vitest';
import CatchAllPage from './page';
import { notFound } from 'next/navigation';

vi.mock('next/navigation', () => ({
notFound: vi.fn(),
}));

describe('CatchAllPage', () => {
it('should call notFound on render', () => {
render(<CatchAllPage />);

expect(notFound).toHaveBeenCalled();
});
});
6 changes: 6 additions & 0 deletions app/[locale]/[...rest]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { notFound } from 'next/navigation';

export default function CatchAllPage() {
notFound();
return null;
}
53 changes: 53 additions & 0 deletions app/[locale]/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@import '~react-toastify/ReactToastify.css';

:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}

@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}
}

body {
color: rgb(var(--foreground-rgb));
min-height: 100vh;
}

@layer utilities {
.text-balance {
text-wrap: balance;
}

.scrollbar::-webkit-scrollbar {
width: 12px;
}

.scrollbar::-webkit-scrollbar-thumb {
background-color: #6bc8ed;
border-radius: 9999px;
border: 3px solid #ffffff;
}

.scrollbar::-webkit-scrollbar-track {
background-color: #e0e0e0;
border-radius: 9999px;
}

.scrollbar::-webkit-scrollbar-thumb:hover {
background-color: #38a9f5;
}

.scrollbar::-webkit-scrollbar-thumb:active {
background-color: #faeb65;
}
}
9 changes: 9 additions & 0 deletions app/[locale]/graph-ql/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function GraphQlPage() {
return (
<main className="flex-1">
<h1 className="text-3xl my-8 bg-[#fbfd70] font-bold underline text-center">
GraphQl
</h1>
</main>
);
}
9 changes: 9 additions & 0 deletions app/[locale]/history/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function ApiHistoryPage() {
return (
<main className="flex-1">
<h1 className="text-3xl my-8 bg-[#fbfd70] font-bold underline text-center">
History
</h1>
</main>
);
}
Binary file added app/[locale]/icon.ico
Binary file not shown.
48 changes: 48 additions & 0 deletions app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
import './globals.css';
import ErrorBoundary from '@/components/errorBoundary/ErrorBoundary';
import { ToastContainer } from 'react-toastify';
import 'react-toastify/ReactToastify.css';

import { NextIntlClientProvider } from 'next-intl';
import { getMessages } from 'next-intl/server';
import { Header } from '@/components/header/Header';
import { Footer } from '@/components/footer/Footer';
import { AuthContextProvider } from '@/context/AuthContext';

const inter = Inter({ subsets: ['latin'] });

export const metadata: Metadata = {
title: 'GraphiQl APP',
description: 'Graph + REST',
};

export default async function RootLayout({
children,
params: { locale },
}: {
children: React.ReactNode;
params: { locale: string };
}) {
const messages = await getMessages();

return (
<html lang={locale}>
<body className={inter.className}>
<NextIntlClientProvider messages={messages}>
<ErrorBoundary>
<AuthContextProvider>
<div className="flex flex-col min-h-screen">
<Header />
{children}
<Footer />
<ToastContainer />
</div>
</AuthContextProvider>
</ErrorBoundary>
</NextIntlClientProvider>
</body>
</html>
);
}
44 changes: 44 additions & 0 deletions app/[locale]/login/page.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { render, screen } from '@testing-library/react';
import SignInPage from './page';
import { vi } from 'vitest';
import { useAuth } from '@/context/AuthContext';
import { useTranslations } from 'next-intl';
import { useRouter } from 'next/navigation';

// Mock necessary hooks
vi.mock('next/navigation', () => ({
useRouter: vi.fn(),
}));

vi.mock('@/context/AuthContext', () => ({
useAuth: vi.fn(),
}));

vi.mock('next-intl', () => ({
useTranslations: vi.fn(),
}));

describe('SignInPage', () => {
const mockPush = vi.fn();
const mockLogIn = vi.fn();
const mockUseRouter = useRouter as jest.Mock;
const mockUseAuth = useAuth as jest.Mock;
const mockUseTranslations = useTranslations as jest.Mock;

beforeEach(() => {
mockUseRouter.mockReturnValue({ push: mockPush });
mockUseAuth.mockReturnValue({ authUser: null, logIn: mockLogIn });
mockUseTranslations.mockReturnValue((key: string) => key);
});

afterEach(() => {
vi.clearAllMocks();
});

test('renders LoginForm component', () => {
render(<SignInPage />);

const mainElement = screen.getByRole('main');
expect(mainElement).toHaveClass('flex-1 flex items-center justify-center');
});
});
9 changes: 9 additions & 0 deletions app/[locale]/login/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import LoginForm from '@/components/auth/LoginForm';

export default function SignInPage() {
return (
<main className="flex-1 flex items-center justify-center">
<LoginForm />
</main>
);
}
Loading