From e53e42706b92c6902c4f73153b07b2e4e961161b Mon Sep 17 00:00:00 2001
From: Lukas Kucera <85391931+kucera-lukas@users.noreply.github.com>
Date: Wed, 13 Apr 2022 02:58:06 +0200
Subject: [PATCH] release v1.0.0 (#141)
---
README.md | 32 ++++++++++++++++---
.../password-strength.constants.ts | 2 +-
src/components/navigation/next.link.tsx | 2 +-
src/components/navigation/text.link.tsx | 2 +-
.../docs/components/docs.component.tsx | 3 ++
src/features/docs/components/docs.item.tsx | 24 +++++++++++---
src/features/docs/docs.constants.ts | 25 +++++++++++----
src/features/docs/docs.types.ts | 2 +-
.../components/image-table.component.tsx | 16 ++++++++--
src/layouts/navbar/navbar.tsx | 2 +-
10 files changed, 86 insertions(+), 24 deletions(-)
diff --git a/README.md b/README.md
index 093a42f2..c724c9d3 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
[![Production deployment](https://api.netlify.com/api/v1/badges/a154da12-c432-4157-b1b2-52876346d0db/deploy-status)](https://stegoer.netlify.app/)
[![Continuous Integration](https://github.com/stegoer/client/actions/workflows/ci.yml/badge.svg)](https://github.com/stegoer/client/actions/workflows/ci.yml)
[![Docs](https://github.com/stegoer/client/actions/workflows/docs.yml/badge.svg)](https://github.com/stegoer/client/actions/workflows/docs.yml)
-[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/stegoer/client/main.svg)](https://results.pre-commit.ci/latest/github/stegoer/client/main)
+[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/stegoer/client/master.svg)](https://results.pre-commit.ci/latest/github/stegoer/client/master)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://prettier.io/)
Client is using TypeScript, NextJS and GraphQL.
@@ -12,19 +12,32 @@ Client is using TypeScript, NextJS and GraphQL.
Client website: https://stegoer.netlify.app/
+Development documentation: https://github.com/stegoer/client/blob/master/README.md
+
+Reference documentation: https://stegoer.github.io/client
+
Source code: https://github.com/stegoer/client
---
## Installation
-### Install dependencies
+### Install instructions
+
+1. Install Node.js https://nodejs.org/en/download/
+2. Clone this repository
+
+```sh
+git clone git@github.com:stegoer/client.git
+```
+
+4. Install dependencies
```sh
npm install
```
-### Create the `.env.local` file
+#### Create the `.env.local` file
Create a `.env.local` file and copy the contents of `.env.local.example` file into the `.env.local` file
@@ -40,6 +53,12 @@ cp .env.local.example .env.local
npm run dev
```
+### [package.json](https://github.com/stegoer/client/blob/master/package.json) scripts
+
+```sh
+npm run-script
+```
+
### GraphQL
[GraphQL Code Generator](https://www.graphql-code-generator.com/)
@@ -49,7 +68,7 @@ configuration options.
#### Codegen
```sh
-npm run gen
+npm run graphql:gen
```
To add a new query or mutation head to `src/graphql/user` or
@@ -57,7 +76,7 @@ To add a new query or mutation head to `src/graphql/user` or
To add a new fragment head to the `src/graphql/fragments` folder.
-### Docs
+### Reference documentation
```sh
npm run docs:build
@@ -68,6 +87,9 @@ which is then published via the
[Docs GitHub Action](https://github.com/stegoer/client/blob/master/.github/workflows/docs.yml)
on [GitHub Pages](https://pages.github.com/).
+See [typedoc.json](https://github.com/stegoer/client/blob/master/typedoc.json)
+for configuration.
+
## Contributing
```sh
diff --git a/src/components/input/password-strength/password-strength.constants.ts b/src/components/input/password-strength/password-strength.constants.ts
index 3db38b36..423bbeb3 100644
--- a/src/components/input/password-strength/password-strength.constants.ts
+++ b/src/components/input/password-strength/password-strength.constants.ts
@@ -1,4 +1,4 @@
-type Requirement = {
+export type Requirement = {
re: RegExp;
label: string;
};
diff --git a/src/components/navigation/next.link.tsx b/src/components/navigation/next.link.tsx
index 7b2446db..81f7be65 100644
--- a/src/components/navigation/next.link.tsx
+++ b/src/components/navigation/next.link.tsx
@@ -2,7 +2,7 @@ import Link from "next/link";
import type { PropsWithChildren } from "react";
-type NextLinkProps = PropsWithChildren<{
+export type NextLinkProps = PropsWithChildren<{
href: string;
passHref?: boolean;
}>;
diff --git a/src/components/navigation/text.link.tsx b/src/components/navigation/text.link.tsx
index aeba3122..6670d71a 100644
--- a/src/components/navigation/text.link.tsx
+++ b/src/components/navigation/text.link.tsx
@@ -2,7 +2,7 @@ import { Text } from "@mantine/core";
import type { PropsWithChildren } from "react";
-type TextLinkProps = PropsWithChildren<{
+export type TextLinkProps = PropsWithChildren<{
href: string;
}>;
diff --git a/src/features/docs/components/docs.component.tsx b/src/features/docs/components/docs.component.tsx
index 148f8641..72094e56 100644
--- a/src/features/docs/components/docs.component.tsx
+++ b/src/features/docs/components/docs.component.tsx
@@ -10,6 +10,9 @@ const DocsComponent = (): JSX.Element => {
+
+
+
);
};
diff --git a/src/features/docs/components/docs.item.tsx b/src/features/docs/components/docs.item.tsx
index bdda999f..9a4ebf44 100644
--- a/src/features/docs/components/docs.item.tsx
+++ b/src/features/docs/components/docs.item.tsx
@@ -1,21 +1,35 @@
import { List } from "@mantine/core";
-import { DOCUMENTATION_URLS, SOURCE_URLS } from "@features/docs/docs.constants";
+import {
+ DEVELOPMENT_DOCUMENTATION_URLS,
+ REFERENCE_URLS,
+ SOURCE_URLS,
+} from "@features/docs/docs.constants";
import type { DocType } from "@features/docs/docs.types";
import TextLink from "@components/navigation/text.link";
-import { GitHubLogoIcon, ReaderIcon } from "@modulz/radix-icons";
+import { FileIcon, GitHubLogoIcon, ReaderIcon } from "@modulz/radix-icons";
-type DocsItemProps = {
+export type DocsItemProps = {
docType: DocType;
}
const DocsItem = ({ docType }: DocsItemProps): JSX.Element => {
+ const referenceUrl = REFERENCE_URLS[docType]
+
return (
} >
-
- documentation
+
+ development
+ {referenceUrl && (
+ }>
+
+ reference
+
+
+ )
+ }
}>
source
diff --git a/src/features/docs/docs.constants.ts b/src/features/docs/docs.constants.ts
index d282d66f..12e0705a 100644
--- a/src/features/docs/docs.constants.ts
+++ b/src/features/docs/docs.constants.ts
@@ -1,17 +1,30 @@
import type { DocType } from "@features/docs/docs.types";
-export const CLIENT_DOCS_URL = `https://stegoer.github.io/client`;
-export const SERVER_DOCS_URL = `https://pkg.go.dev/github.com/stegoer/server`;
+export const CLIENT_DEVELOPMENT_DOCS_URL = `https://github.com/stegoer/client/blob/master/README.md`;
+export const SERVER_DEVELOPMENT_DOCS_URL = `https://github.com/stegoer/server/blob/main/README.md`;
+export const DOCUMENTATION_DEVELOPMENT_DOCS_URL = `https://github.com/stegoer/documentation/blob/main/README.md`;
-export const DOCUMENTATION_URLS: Record = {
- client: CLIENT_DOCS_URL,
- server: SERVER_DOCS_URL,
+export const DEVELOPMENT_DOCUMENTATION_URLS: Record = {
+ client: CLIENT_DEVELOPMENT_DOCS_URL,
+ server: SERVER_DEVELOPMENT_DOCS_URL,
+ documentation: DOCUMENTATION_DEVELOPMENT_DOCS_URL
+}
+
+export const CLIENT_REFERENCE_URL = `https://stegoer.github.io/client`;
+export const SERVER_REFERENCE_URL = `https://pkg.go.dev/github.com/stegoer/server`;
+
+export const REFERENCE_URLS: Record = {
+ client: CLIENT_REFERENCE_URL,
+ server: SERVER_REFERENCE_URL,
+ documentation: undefined,
}
export const CLIENT_SOURCE_URL = `https://github.com/stegoer/client`;
export const SERVER_SOURCE_URL = `https://github.com/stegoer/server`;
+export const DOCUMENTATION_SOURCE_URL = `https://github.com/stegoer/documentation`;
export const SOURCE_URLS: Record = {
client: CLIENT_SOURCE_URL,
- server: SERVER_SOURCE_URL
+ server: SERVER_SOURCE_URL,
+ documentation: DOCUMENTATION_SOURCE_URL
}
diff --git a/src/features/docs/docs.types.ts b/src/features/docs/docs.types.ts
index 0cff7e5b..4e27e03b 100644
--- a/src/features/docs/docs.types.ts
+++ b/src/features/docs/docs.types.ts
@@ -1 +1 @@
-export type DocType = `client` | `server`;
+export type DocType = `client` | `server` | `documentation`;
diff --git a/src/features/image-table/components/image-table.component.tsx b/src/features/image-table/components/image-table.component.tsx
index c67d4c26..e2c2c9dd 100644
--- a/src/features/image-table/components/image-table.component.tsx
+++ b/src/features/image-table/components/image-table.component.tsx
@@ -20,6 +20,8 @@ const ImageTable = dynamic(
() => import(`@features/image-table/components/image-table/image-table`),
);
+const navigationDisabledTimeout = 500; // 0.5 seconds
+
const calculateEdgesIndexes = (page: number): readonly [number, number] => {
return [(page - 1) * IMAGE_TABLE_PER_PAGE, page * IMAGE_TABLE_PER_PAGE];
};
@@ -40,6 +42,7 @@ const ImageTableComponent = (): JSX.Element => {
// relay pagination based query
const [first, setFirst] = useState(IMAGE_TABLE_PER_PAGE);
const [last, setLast] = useState();
+ const [navigationDisabled, setNavigationDisabled] = useState(false);
const [startCursor, setStartCursor] = useState();
const [endCursor, setEndCursor] = useState();
const [imagesQuery, fetchImages] = useImagesQuery({
@@ -55,7 +58,7 @@ const ImageTableComponent = (): JSX.Element => {
},
});
// UI constants
- const loading = !imagesQuery.data && imagesQuery.fetching;
+ const loading = imagesQuery.fetching;
const isFirstPage = page === 1;
const isLastPage = Boolean(
imagesQuery.data?.images.totalCount === 0 ||
@@ -78,6 +81,12 @@ const ImageTableComponent = (): JSX.Element => {
const onMove = useCallback(
(direction: MoveDirection) => {
+ // don't allow user to change pages quickly
+ setNavigationDisabled(true);
+ setTimeout(() => {
+ setNavigationDisabled(false);
+ }, navigationDisabledTimeout);
+
const isLeft = direction === `left`;
// don't set new variables if we would move outside of bounds
@@ -109,7 +118,8 @@ const ImageTableComponent = (): JSX.Element => {
return (
<>
- {loading || imagesQuery.data?.images.edges.length === 0 ? (
+ {(loading && !imagesQuery.data) ||
+ imagesQuery.data?.images.edges.length === 0 ? (
{
/>
)}
;