Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: major improvements, add search, streamline project structure #98

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions documentation/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["../.eslintrc.json"],
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ custom_edit_url: null

`import { LinkWithStatePassthrough } from '@orfium/toolbox';`

### Description
## Description

A utility component that wraps over React Router's [`Link`](https://v5.reactrouter.com/web/api/Link) component,
but takes care to pass the _current_ history state over to the next link location.
Expand All @@ -34,6 +34,6 @@ function EmptyPage() {
}
```

### Props
## Props

Ƭ `LinkProps`
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ custom_edit_url: null

`import { NavLinkWithStatePassthrough } from '@orfium/toolbox';`

### Description
## Description

A utility component that wraps over React Router's [`NavLink`](https://v5.reactrouter.com/web/api/NavLink) component,
but takes care to pass the _current_ history state over to the next link location.
Expand All @@ -34,6 +34,6 @@ function EmptyPage() {
}
```

### Props
## Props

Ƭ `NavLinkProps`
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,34 @@ import Type from '../_type-definitions/NavigationProps.md';

`import { Navigation } from '@orfium/toolbox';`

### Description
## Description

A UI component that handles user navigation both within the current product and among Orfium products. It is comprised of
two main parts, the **global navigation bar** and the **local navigation drawer**.

#### Global navigation bar
### Global navigation bar

Top-to-bottom, it consists of :

* An **hamburger button** that when clicked will toggle the **local navigation drawer**. **(Small screens only)**
* A **list of icon links** corresponding to all the Orfium products that are available to the user. The currently used product
icon is highlighted.
* An **extra button** that when clicked will navigate to `/admin` (configurable by `adminNavigationURLSegment`) and toggle
the contents of the [**main navigation section**](#local-navigation-drawer) between the admin-only and the regular navigation menu. **(Admin users only)**
- An **hamburger button** that when clicked will toggle the **local navigation drawer**. **(Small screens only)**
- A **list of icon links** corresponding to all the Orfium products that are available to the user. The currently used product
icon is highlighted.
- An **extra button** (![admin button](/img/admin_button.png)) that when clicked will navigate to `/admin` (configurable by `adminNavigationURLSegment`) and toggle
the contents of the [**main navigation section**](#local-navigation-drawer) between the admin-only (`adminNavigation`) and the regular navigation (`regularNavigation`) menu. **(Admin users only)**


#### Local navigation drawer
### Local navigation drawer

Top-to-bottom, it consists of three main sections:

* the **organisation switcher**, which allows the user to switch between the organisations available to their account. **(Controlled by** `hideOrgSwitcher`**)**
* the **main navigation section**, which lists links internal to the currently used application. Admin-only navigation will
show up here.
* the **extra information section**, which can contain various external links to educational or support material. **(Optional)**
- the **organisation switcher**, which allows the user to switch between the organisations available to their account. **(Controlled by** `hideOrgSwitcher`**)**
- the **main navigation section**, which lists links internal to the currently used application. Admin-only navigation will
show up here.
- the **extra information section**, which can contain various external links to educational or support material. **(Optional)**

You can read more [here](/docs/modules/UI/Navigation%20Component).
You can read more [here](/docs/tutorials/Installation%20and%20Usage/UI/Navigation%20Component).

:::info
Exiting the admin-only navigation by clicking the extra admin button will take you back to exactly where you were before
Exiting the admin-only navigation by clicking the extra admin button (![admin button](/img/admin_button.png)) will take you back to exactly where you were before
entering the admin-only navigation, restoring any previously applied URL params, _as long as you navigated using only
the local navigation drawer links_.

Expand All @@ -56,7 +55,7 @@ above functionality. Use the utility components [`RedirectWithStatePassthrough`]
URL path.
:::

### Props
## Props

Ƭ [`NavigationProps`](../types/NavigationProps)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ custom_edit_url: null

`import { RedirectWithStatePassthrough } from '@orfium/toolbox';`

### Description
## Description

A utility component that wraps over React Router's [`Redirect`](https://v5.reactrouter.com/web/api/Redirect) component,
but takes care to pass the _current_ history state over to the next redirect location.
Expand All @@ -34,6 +34,6 @@ function EmptyPage() {
}
```

### Props
## Props

Ƭ `RedirectProps`
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import Type from '../_type-definitions/ToolboxProps.md';

`import { Toolbox } from '@orfium/toolbox';`

### Description
## Description

A provider component that manages user authentication. You will need to wrap your app with it in order to use Orfium's
SSO mechanism and to be able to use the [`useAuthentication`](../hooks/useAuthentication),
[`useOrganizations`](../hooks/useOrganizations), [`useOrfiumProducts`](../hooks/useOrfiumProducts) and [`useTopBarUtilitySection`](../hooks/useTopBarUtilitySection) hooks.

### Props
## Props

Ƭ [`ToolboxProps`](../types/ToolboxProps)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import Type from '../_type-definitions/TopBarProps.md';

`import { TopBar } from '@orfium/toolbox';`

### Description
## Description

A UI component that holds other UI elements such as the user menu on the right and an optional utility section on the
left. Read more [here](/docs/modules/UI/Top%20Bar%20Component).
left. Read more [here](/docs/tutorials/Installation%20and%20Usage/UI/Top%20Bar%20Component).

The component will display whatever you pass down as a value to the `utilitySection` prop, unless some other component
is making use of the [`useTopBarUtilitySection`](../hooks/useTopBarUtilitySection) hook at the same time. In that case
the value passed to the hook will take precedence over the value of the `utilitySection` prop.

### Props
## Props

Ƭ [`TopBarProps`](../types/TopBarProps)

Expand Down
3 changes: 3 additions & 0 deletions documentation/docs/api/Components/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"position": 1
}
3 changes: 3 additions & 0 deletions documentation/docs/api/Hooks/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"position": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import Type from '../_type-definitions/AuthenticationContextValue.md';
Only descendants of [`Toolbox`](../components/Toolbox) can use this hook.
:::

### Description
## Description

A hook that returns an assortment of authentication related methods and data.

### Parameters
## Parameters

None

### Return value
## Return value

Ƭ [`AuthenticationContextValue`](../types/AuthenticationContextValue)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ custom_edit_url: null

`import { useData } from '@orfium/toolbox';`

### Description
## Description

Encapsulates useQuery hook providing specific controls over the react-query library. Based on the passed parameters
constructs a dynamic query key and provides specific api params (settings) for the api handler function.

#### Example
**Example Usage**

```typescript jsx
import { useData } from '@orfium/toolbox';
Expand All @@ -42,13 +42,13 @@ const CustomComponent: FC = () => {
};
```

### Parameters
## Parameters

- `dataType: DataType` - Generic typed parameter that is needed for dynamic query key construction
- `fetchData: (settings?: SettingsTypes) => Promise<ResponseType>` - the api handler that returns a promise with the fetched data. It contains an optional parameter `settings`.
- `settings?: SettingsTypes` - the parameters needs to make a query key unique.
- `overrideDefaultQueryOptions?: UseQueryOptions<ResponseType>` - the options needed to override existing react query option.

### Return value
## Return value

Ƭ `ReturnType<typeof useQuery>`
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ custom_edit_url: null

`import { useDataPagination } from '@orfium/toolbox';`

### Description
## Description

Enables pagination with next page prefetching and caching previous fetched pages.

#### Example
**Example Usage**

```typescript jsx
import { useData, useDataPagination } from '@orfium/toolbox';
Expand Down Expand Up @@ -54,7 +54,7 @@ const CustomComponent: FC = () => {
};
```

### Parameters
## Parameters

- `dataType: DataType` - Generic typed parameter that is needed for dynamic query key construction
- `fetchData: (settings?: SettingsTypes) => Promise<ResponseType>` - the api handler that returns a promise with the fetched data. It contains an optional parameter `settings`.
Expand All @@ -63,6 +63,6 @@ const CustomComponent: FC = () => {
- `overridePage?: { offset: number; step: number }`
- `overrideDefaultQueryOptions?: UseQueryOptions<ResponseType>`

### Return value
## Return value

Ƭ `ReturnType<typeof useQuery> & { isFetchingNextPage: boolean; }`
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ custom_edit_url: null

`import { useDeferredValue } from '@orfium/toolbox';`

### Description
## Description

Polyfill for [useDeferredValue](https://react.dev/reference/react/useDeferredValue) for projects that use React < 18. Works exactly the same
way as the native hook, but adds an optional parameter for controlling the delay

### Parameters
## Parameters

- `value: T` - The value that will ultimately get set in a deferred manner.
- `duration?: number` - (_default: 800_) The value in ms that should act as delay before the value is updated.
- `duration?: number` - The value in ms that should act as delay before the value is updated **(default: 800)**.

### Return value
## Return value

Ƭ `T`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import Type from '../_type-definitions/OrfiumProductsContextValue.md';
Only descendants of [`Toolbox`](../components/Toolbox) can use this hook.
:::

### Description
## Description

A hook that returns a list of Orfium products that are available to the user.

### Parameters
## Parameters

None

### Return value
## Return value

Ƭ [`OrfiumProductsContextValue`](../types/OrfiumProductsContextValue)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import Type from '../_type-definitions/OrganizationsContextValue.md';
Only descendants of [`Toolbox`](../components/Toolbox) can use this hook.
:::

### Description
## Description

A hook that returns an assortment of organizations related methods and data available to the user.

### Parameters
## Parameters

None

### Return value
## Return value

Ƭ [`OrganizationsContextValue`](../types/OrganizationsContextValue)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ custom_edit_url: null

`import { useSafeContext } from '@orfium/toolbox';`

### Description
## Description

Accepts two parameters a **React context instance**, and a ** string** that specifies the name of the context.
It will throw an exception if someone tries to use hook outside of provider.

```typescript jsx
```tsx
import { useSafeContext } from '@orfium/toolbox';

const CustomContext = React.createContext(null);
Expand All @@ -27,11 +27,11 @@ _Error log_
Error: useCustomContext must be used within a CustomContextProvider
```

### Parameters
## Parameters

- `context: Context<T>`
- `hookName: string`

### Return value
## Return value

Ƭ `NonNullable<T>`
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ custom_edit_url: null

`import { useSafeDispatch } from '@orfium/toolbox';`

### Description
## Description

Accepts a **dispatch method** generated from a `useReducer` hook.
It will return an optimized and guarded dispatch callback which will be invoked only when the component is mounted.

```typescript jsx
```tsx
import { useSafeDispatch } from '@orfium/toolbox';

type State = Record<string,string> | null;
Expand Down Expand Up @@ -42,11 +42,11 @@ export const Component = () => {

```

### Parameters
## Parameters

* `dispatch: Dispatch<T>`

### Return value
## Return value

Ƭ `(actionEntity: T) => void`

Loading
Loading