You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/design-system/custom-components/application-container.md
+53-23Lines changed: 53 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,44 +4,74 @@ sidebar_position: 1
4
4
5
5
# Application Container
6
6
7
-
The `Application` container handles network status changes and displays appropriate toast notifications. It has **built-in** functionality that automatically handles these changes.
7
+
The Application container handles core application-wide functionality, including service worker integration, custom storage management, and network status detection. It provides a centralized way to manage these features within your app.
8
8
9
9
## Features
10
10
11
-
-**Built-in Offline/Online Notifications**: The `Application` component monitors the network status. It shows toast messages when the app goes offline or comes back online.
12
-
-**Custom Hooks**: It leverages the `useToasts` and `useOfflineStatus` hooks from within `@nmfs-radfish/react-radfish` package.
11
+
1.**Service Worker for Offline Caching**
13
12
14
-
## How It Works
13
+
The Application container supports service worker integration, enabling offline capabilities by caching static assets and handling API requests when the network is unavailable.
15
14
16
-
### Built-in Offline/Online Notifications
15
+
2.**Pluggable Storage**
17
16
18
-
The `Application` component has **built-in** functionality to check the application's network status. It displays toast notifications when the state changes:
17
+
Pass in IndexedDB or LocalStorage storage methods.
19
18
20
-
-**When the application goes offline**: A warning toast is displayed with the message `"Application is offline"`.
21
-
-**When the application comes back online**: An info toast is displayed with the message `"Application is online"`.
19
+
3.**Offline/Online Detection**
22
20
23
-
This feature is provided **out of the box**and requires no additional setup from your side.
21
+
Automatically detects network changes and displays toast notifications:
24
22
25
-
### Example Usage
23
+
- Offline: Shows a warning toast with "Application is offline".
24
+
- Online: Shows an informational toast with "Application is online".
26
25
27
-
To use the `Application` component, wrap it around your app in the entry file (e.g. `index.js` or `index.jsx`):
26
+
## Usage
27
+
28
+
### Setting up Application instance
29
+
30
+
To use the `Application` container, instantiate it with your desired configuration:
- Offers **React components and hooks** that make it easy to integrate `Application` container into a React app.
68
+
- Provides:
69
+
-`<Application>` component for wrapping your app with offline support.
70
+
- Hooks like `useOfflineStatus` for checking network connectivity.
71
+
-`useOfflineStorage` for managing offline storage state within React components.
72
+
- This package is **React-specific** and simplifies working with the `Application` container in a React project.
44
73
45
-
While the `Application` component provides **out-of-the-box** functionality for network status notifications, you can also use RADFish's custom hooks—`useToasts` and `useOfflineStatus`—independently for more control over toast messages and offline status in other parts of your application.
74
+
#### In Other Words:
46
75
47
-
For more information on how to use these hooks, refer to the [RADFish Custom Hooks Documentation](link-to-hooks-documentation). -->
76
+
-**`@nmfs-radfish/radfish`** = the **engine** (all the logic).
77
+
-**`@nmfs-radfish/react-radfish`** = the **React car** that sits on top of the engine, making it easy to drive your offline-ready web app in React.
0 commit comments