@skalfa/skalfa-app 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +43 -43
- package/.github/workflows/publish.yml +39 -0
- package/CONTRIBUTING.md +45 -0
- package/LICENSE +21 -0
- package/README.md +91 -28
- package/app/auth/edit/page.tsx +65 -65
- package/app/auth/login/page.tsx +63 -63
- package/app/auth/me/page.tsx +58 -58
- package/app/auth/register/page.tsx +69 -69
- package/app/auth/verify/page.tsx +53 -53
- package/app/dashboard/user/page.tsx +76 -76
- package/app/layout.tsx +37 -37
- package/app/manifest.ts +25 -0
- package/app/page.tsx +13 -13
- package/barrels.json +5 -5
- package/blueprints/starter.blueprint.json +102 -102
- package/bun.lock +916 -0
- package/components/base.components/chip/Chip.component.tsx +39 -39
- package/components/base.components/document/DocumentViewer.component.tsx +163 -163
- package/components/base.components/document/ExportExcel.component.tsx +340 -340
- package/components/base.components/document/ImportExcel.component.tsx +315 -315
- package/components/base.components/document/PrintTable.component.tsx +204 -204
- package/components/base.components/document/RenderPDF.component.tsx +415 -415
- package/components/base.components/input/Checkbox.component.tsx +109 -109
- package/components/base.components/input/Input.component.tsx +332 -332
- package/components/base.components/input/InputCheckbox.component.tsx +174 -174
- package/components/base.components/input/InputCurrency.component.tsx +163 -163
- package/components/base.components/input/InputDate.component.tsx +352 -352
- package/components/base.components/input/InputDatetime.component.tsx +260 -260
- package/components/base.components/input/InputDocument.component.tsx +351 -351
- package/components/base.components/input/InputImage.component.tsx +533 -533
- package/components/base.components/input/InputMap.component.tsx +317 -317
- package/components/base.components/input/InputNumber.component.tsx +192 -192
- package/components/base.components/input/InputOtp.component.tsx +169 -169
- package/components/base.components/input/InputPassword.component.tsx +236 -236
- package/components/base.components/input/InputRadio.component.tsx +175 -175
- package/components/base.components/input/InputTime.component.tsx +275 -275
- package/components/base.components/input/InputValues.component.tsx +68 -68
- package/components/base.components/input/Radio.component.tsx +102 -102
- package/components/base.components/input/Select.component.tsx +541 -541
- package/components/base.components/modal/BottomSheet.component.tsx +245 -245
- package/components/base.components/supervision/FormSupervision.component.tsx +433 -433
- package/components/base.components/supervision/TableSupervision.component.tsx +697 -697
- package/components/base.components/table/ControlBar.component.tsx +497 -497
- package/components/base.components/table/FilterComponent.tsx +518 -518
- package/components/base.components/table/Table.component.tsx +469 -469
- package/components/base.components/typography/TypographyArticle.component.tsx +26 -26
- package/components/base.components/typography/TypographyColumn.component.tsx +20 -20
- package/components/base.components/typography/TypographyContent.component.tsx +20 -20
- package/components/base.components/typography/TypographyTips.component.tsx +20 -20
- package/components/base.components/wrap/Draggable.component.tsx +303 -303
- package/components/base.components/wrap/IDBProvider.tsx +12 -12
- package/components/base.components/wrap/Image.component.tsx +9 -9
- package/components/base.components/wrap/ShortcutProvider.tsx +57 -57
- package/components/base.components/wrap/Swipe.component.tsx +93 -93
- package/components/index.ts +2 -2
- package/contexts/AppProvider.tsx +11 -11
- package/contexts/Auth.context.tsx +64 -64
- package/contexts/Toggle.context.tsx +44 -44
- package/next.config.ts +15 -1
- package/package.json +14 -13
- package/public/204.svg +19 -19
- package/public/500.svg +39 -39
- package/public/icon-192.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/images/logo-fill.png +0 -0
- package/public/images/logo-full-fill.png +0 -0
- package/public/images/logo-full.png +0 -0
- package/public/images/logo.png +0 -0
- package/schema/idb/app.schema.ts +8 -8
- package/src-tauri/Cargo.toml +14 -0
- package/src-tauri/build.rs +3 -0
- package/src-tauri/capabilities/default.json +11 -0
- package/src-tauri/icons/128x128.png +0 -0
- package/src-tauri/icons/128x128@2x.png +0 -0
- package/src-tauri/icons/32x32.png +0 -0
- package/src-tauri/icons/icon.icns +0 -0
- package/src-tauri/icons/icon.ico +0 -0
- package/src-tauri/src/main.rs +7 -0
- package/src-tauri/tauri.conf.json +36 -0
- package/styles/globals.css +231 -231
- package/styles/tailwind.safelist +68 -68
- package/utils/commands/barrels.ts +27 -27
- package/utils/commands/light.ts +21 -21
- package/utils/commands/logger.ts +42 -42
- package/utils/commands/stubs/table-blueprint.stub +12 -12
- package/utils/commands/use-pdf.ts +29 -29
package/.env.example
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
# =========================>
|
|
2
|
-
# ## Base configuration
|
|
3
|
-
# =========================>
|
|
4
|
-
NEXT_PUBLIC_APP_NAME="NEXT-LIGHT"
|
|
5
|
-
NEXT_PUBLIC_DEBUG=false
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# =========================>
|
|
9
|
-
# ## Api configuration
|
|
10
|
-
# =========================>
|
|
11
|
-
NEXT_PUBLIC_API_HOST="http://localhost:4000/api"
|
|
12
|
-
NEXT_PUBLIC_STORAGE_HOST="http://localhost:4000/storage"
|
|
13
|
-
NEXT_PUBLIC_API_HEADERS=""
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# =========================>
|
|
17
|
-
# ## Socket configuration
|
|
18
|
-
# =========================>
|
|
19
|
-
NEXT_PUBLIC_SOCKET_HOST=""
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# =========================>
|
|
23
|
-
# ## Cookie configuration
|
|
24
|
-
# =========================>
|
|
25
|
-
NEXT_PUBLIC_COOKIE_KEY=""
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# =========================>
|
|
29
|
-
# ## Socket configuration
|
|
30
|
-
# =========================>
|
|
31
|
-
NEXT_PUBLIC_SOCKET_HOST=""
|
|
32
|
-
NEXT_PUBLIC_SOCKET_KEY=""
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
# =========================>
|
|
36
|
-
# ## Map configuration
|
|
37
|
-
# =========================>
|
|
38
|
-
NEXT_PUBLIC_MAP_KEY="";
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# =========================>
|
|
42
|
-
# ## Exposed port (when using docker)
|
|
43
|
-
# =========================>
|
|
1
|
+
# =========================>
|
|
2
|
+
# ## Base configuration
|
|
3
|
+
# =========================>
|
|
4
|
+
NEXT_PUBLIC_APP_NAME="NEXT-LIGHT"
|
|
5
|
+
NEXT_PUBLIC_DEBUG=false
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# =========================>
|
|
9
|
+
# ## Api configuration
|
|
10
|
+
# =========================>
|
|
11
|
+
NEXT_PUBLIC_API_HOST="http://localhost:4000/api"
|
|
12
|
+
NEXT_PUBLIC_STORAGE_HOST="http://localhost:4000/storage"
|
|
13
|
+
NEXT_PUBLIC_API_HEADERS=""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# =========================>
|
|
17
|
+
# ## Socket configuration
|
|
18
|
+
# =========================>
|
|
19
|
+
NEXT_PUBLIC_SOCKET_HOST=""
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# =========================>
|
|
23
|
+
# ## Cookie configuration
|
|
24
|
+
# =========================>
|
|
25
|
+
NEXT_PUBLIC_COOKIE_KEY=""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# =========================>
|
|
29
|
+
# ## Socket configuration
|
|
30
|
+
# =========================>
|
|
31
|
+
NEXT_PUBLIC_SOCKET_HOST=""
|
|
32
|
+
NEXT_PUBLIC_SOCKET_KEY=""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# =========================>
|
|
36
|
+
# ## Map configuration
|
|
37
|
+
# =========================>
|
|
38
|
+
NEXT_PUBLIC_MAP_KEY="";
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# =========================>
|
|
42
|
+
# ## Exposed port (when using docker)
|
|
43
|
+
# =========================>
|
|
44
44
|
NEXT_PUBLIC_PORT=3000
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- master
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout repository
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Setup Node.js
|
|
17
|
+
uses: actions/setup-node@v4
|
|
18
|
+
with:
|
|
19
|
+
node-version: 20
|
|
20
|
+
registry-url: https://registry.npmjs.org/
|
|
21
|
+
|
|
22
|
+
- name: Setup Bun
|
|
23
|
+
uses: oven-sh/setup-bun@v1
|
|
24
|
+
with:
|
|
25
|
+
bun-version: latest
|
|
26
|
+
|
|
27
|
+
- name: Publish if version bumped
|
|
28
|
+
run: |
|
|
29
|
+
LOCAL_VER=$(node -p "require('./package.json').version")
|
|
30
|
+
NPM_VER=$(npm view @skalfa/skalfa-app version 2>/dev/null || echo "0.0.0")
|
|
31
|
+
if [ "$LOCAL_VER" != "$NPM_VER" ]; then
|
|
32
|
+
echo "Publishing @skalfa/skalfa-app $LOCAL_VER (Registry version: $NPM_VER)"
|
|
33
|
+
bun install
|
|
34
|
+
npm publish --access public
|
|
35
|
+
else
|
|
36
|
+
echo "@skalfa/skalfa-app is up to date ($LOCAL_VER)"
|
|
37
|
+
fi
|
|
38
|
+
env:
|
|
39
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Contributing to @skalfa/skalfa-app
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to Skalfa! We welcome contributions from the community to help make Skalfa the premier development framework.
|
|
4
|
+
|
|
5
|
+
## How to Contribute
|
|
6
|
+
|
|
7
|
+
To contribute to this package, please follow these standard open-source steps:
|
|
8
|
+
|
|
9
|
+
### 1. Fork the Repository
|
|
10
|
+
Fork the official Skalfa repository on GitHub to your personal account.
|
|
11
|
+
|
|
12
|
+
### 2. Clone Your Fork
|
|
13
|
+
Clone your personal fork to your local machine:
|
|
14
|
+
```bash
|
|
15
|
+
git clone https://github.com/your-username/skalfa.git
|
|
16
|
+
cd skalfa
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 3. Create a Feature Branch
|
|
20
|
+
Create a new branch for your feature or bugfix:
|
|
21
|
+
```bash
|
|
22
|
+
git checkout -b feature/amazing-new-feature
|
|
23
|
+
```
|
|
24
|
+
*(Use `bugfix/issue-description` for bugfixes).*
|
|
25
|
+
|
|
26
|
+
### 4. Implement and Commit Your Changes
|
|
27
|
+
Make your changes in the codebase. Write clean, formatted code and ensure all tests and typechecks pass. Commit your changes using semantic commit messages:
|
|
28
|
+
```bash
|
|
29
|
+
git commit -m "feat: add amazing new feature"
|
|
30
|
+
```
|
|
31
|
+
*(Use `fix: description` for bugfixes, and `docs: description` for documentation updates).*
|
|
32
|
+
|
|
33
|
+
### 5. Push to GitHub
|
|
34
|
+
Push your branch to your personal fork on GitHub:
|
|
35
|
+
```bash
|
|
36
|
+
git push origin feature/amazing-new-feature
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 6. Submit a Pull Request (PR)
|
|
40
|
+
Go to the official Skalfa repository on GitHub. You will see a prompt to submit a pull request. Click "New Pull Request", describe your changes in detail, link any related issues, and submit it for review by the maintainers.
|
|
41
|
+
|
|
42
|
+
## Guidelines
|
|
43
|
+
* **Code Style**: Ensure your code conforms to the project's ESLint rules and formatting guidelines.
|
|
44
|
+
* **Type Safety**: Write strict, type-safe TypeScript. Do not bypass the compiler.
|
|
45
|
+
* **Testing**: Run local tests and verify that the build compiles with 0 errors before submitting a PR.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Skalfa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,28 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://skalfa.sejedigital.com/images/logo-skalfa.png" alt="Skalfa Logo" width="300" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# @skalfa/skalfa-app
|
|
6
|
+
|
|
7
|
+
> Modern frontend starter template built with Next.js, pre-configured with PWA, Tauri, and modular extensions.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## About this Package
|
|
12
|
+
|
|
13
|
+
This package is part of the **Skalfa Framework**, a premium development ecosystem designed to build high-performance, modular web applications and APIs.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Documentation
|
|
18
|
+
|
|
19
|
+
See the usage documentation at [Documentation](https://skalfa.sejedigital.com).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
You can install this package using your preferred package manager:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Using npm
|
|
29
|
+
npm install @skalfa/skalfa-app
|
|
30
|
+
|
|
31
|
+
# Using bun
|
|
32
|
+
bun add @skalfa/skalfa-app
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Development, Testing & Production Scripts
|
|
38
|
+
|
|
39
|
+
This frontend starter template provides the following CLI execution scripts:
|
|
40
|
+
|
|
41
|
+
### 💻 Development
|
|
42
|
+
* **`bun run dev`**: Starts the Next.js development server in hot-reload mode.
|
|
43
|
+
|
|
44
|
+
### 📦 Build & Production
|
|
45
|
+
* **`bun run build`**: Compiles the Next.js application into optimized production build outputs (or static files if Tauri mode is triggered).
|
|
46
|
+
* **`bun run start`**: Starts the Next.js production server.
|
|
47
|
+
|
|
48
|
+
### 🧪 Verification & Linting
|
|
49
|
+
* **`bun run test`**: Performs a strict, project-wide TypeScript compilation check (`tsc --noEmit`) to ensure type-safety.
|
|
50
|
+
* **`bun run lint`**: Runs ESLint to analyze and format the source code.
|
|
51
|
+
|
|
52
|
+
### 🖥️ Tauri Desktop & Mobile (Optional Extensions)
|
|
53
|
+
* **`bun run tauri dev`**: Runs the Tauri desktop application wrapper in development mode.
|
|
54
|
+
* **`bun run tauri build`**: Builds and packages the Tauri desktop application installer.
|
|
55
|
+
* **`bun run tauri:android`**: Runs the Tauri application in an Android emulator.
|
|
56
|
+
* **`bun run tauri:ios`**: Runs the Tauri application in an iOS simulator.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Pre-installed Dependencies
|
|
61
|
+
|
|
62
|
+
The following key dependencies are packaged and managed within this project:
|
|
63
|
+
|
|
64
|
+
| Dependency | Scope | Version |
|
|
65
|
+
| :--- | :--- | :--- |
|
|
66
|
+
| `@fortawesome/fontawesome-svg-core` | runtime | `^6.7.2` |
|
|
67
|
+
| `@fortawesome/free-brands-svg-icons` | runtime | `^6.7.2` |
|
|
68
|
+
| `@fortawesome/free-regular-svg-icons` | runtime | `^6.7.2` |
|
|
69
|
+
| `@fortawesome/free-solid-svg-icons` | runtime | `^6.7.2` |
|
|
70
|
+
| `@fortawesome/react-fontawesome` | runtime | `^0.2.2` |
|
|
71
|
+
| `@react-google-maps/api` | runtime | `^2.20.7` |
|
|
72
|
+
| `@skalfa/skalfa-app-core` | runtime | `^1.0.0` |
|
|
73
|
+
| `@tailwindcss/postcss` | runtime | `^4.0.0` |
|
|
74
|
+
| `axios` | runtime | `^1.12.0` |
|
|
75
|
+
| `moment` | runtime | `^2.30.1` |
|
|
76
|
+
| `next` | runtime | `16.1.1` |
|
|
77
|
+
| `postcss` | runtime | `^8.5.1` |
|
|
78
|
+
| `react` | runtime | `^19.2.1` |
|
|
79
|
+
| `react-dom` | runtime | `^19.2.1` |
|
|
80
|
+
| `tailwindcss` | runtime | `^4.0.0` |
|
|
81
|
+
| `@types/node` | development | `^20` |
|
|
82
|
+
| `@types/react` | development | `^19.0.0` |
|
|
83
|
+
| `@types/react-dom` | development | `^19.0.0` |
|
|
84
|
+
| `eslint` | development | `^9.19.0` |
|
|
85
|
+
| `typescript` | development | `^6.0.3` |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
This package is licensed under the **MIT License**. For full license text, see the [LICENSE](LICENSE) file.
|
package/app/auth/edit/page.tsx
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { useRouter } from "next/navigation";
|
|
4
|
-
import { useAuthContext } from "@contexts";
|
|
5
|
-
import { ButtonComponent, CardComponent, FormSupervisionComponent } from "@components";
|
|
6
|
-
|
|
7
|
-
export default function EditProfile() {
|
|
8
|
-
const router = useRouter();
|
|
9
|
-
const { user } = useAuthContext();
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<>
|
|
13
|
-
<div className="h-screen flex flex-col justify-center items-center">
|
|
14
|
-
<h1 className="text-2xl font-extrabold italic">WELCOME TO NEXT-LIGHT v.3</h1>
|
|
15
|
-
<p className="text-sm font-semibold mt-6">Edit account!</p>
|
|
16
|
-
|
|
17
|
-
<CardComponent className="mt-4 p-6 w-[400px] rounded-2xl">
|
|
18
|
-
<FormSupervisionComponent
|
|
19
|
-
fields={[
|
|
20
|
-
{
|
|
21
|
-
construction: {
|
|
22
|
-
name: "name",
|
|
23
|
-
label: "Nama",
|
|
24
|
-
placeholder: "Ex: Joko Gunawan",
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
construction: {
|
|
29
|
-
name: "email",
|
|
30
|
-
label: "E-mail",
|
|
31
|
-
placeholder: "Ex: example@mail.com",
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
construction: {
|
|
36
|
-
type: "file",
|
|
37
|
-
name: "image",
|
|
38
|
-
label: "Picture",
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
]}
|
|
42
|
-
defaultValue={user}
|
|
43
|
-
submitControl={{
|
|
44
|
-
path: "me/update"
|
|
45
|
-
}}
|
|
46
|
-
onSuccess={() => {
|
|
47
|
-
router.push("/auth/me")
|
|
48
|
-
}}
|
|
49
|
-
footerControl={({loading}) => (
|
|
50
|
-
<>
|
|
51
|
-
<ButtonComponent
|
|
52
|
-
type="submit"
|
|
53
|
-
label="Save Changes"
|
|
54
|
-
block
|
|
55
|
-
className="mt-4"
|
|
56
|
-
loading={loading}
|
|
57
|
-
/>
|
|
58
|
-
</>
|
|
59
|
-
)}
|
|
60
|
-
/>
|
|
61
|
-
</CardComponent>
|
|
62
|
-
</div>
|
|
63
|
-
</>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useRouter } from "next/navigation";
|
|
4
|
+
import { useAuthContext } from "@contexts";
|
|
5
|
+
import { ButtonComponent, CardComponent, FormSupervisionComponent } from "@components";
|
|
6
|
+
|
|
7
|
+
export default function EditProfile() {
|
|
8
|
+
const router = useRouter();
|
|
9
|
+
const { user } = useAuthContext();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<div className="h-screen flex flex-col justify-center items-center">
|
|
14
|
+
<h1 className="text-2xl font-extrabold italic">WELCOME TO NEXT-LIGHT v.3</h1>
|
|
15
|
+
<p className="text-sm font-semibold mt-6">Edit account!</p>
|
|
16
|
+
|
|
17
|
+
<CardComponent className="mt-4 p-6 w-[400px] rounded-2xl">
|
|
18
|
+
<FormSupervisionComponent
|
|
19
|
+
fields={[
|
|
20
|
+
{
|
|
21
|
+
construction: {
|
|
22
|
+
name: "name",
|
|
23
|
+
label: "Nama",
|
|
24
|
+
placeholder: "Ex: Joko Gunawan",
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
construction: {
|
|
29
|
+
name: "email",
|
|
30
|
+
label: "E-mail",
|
|
31
|
+
placeholder: "Ex: example@mail.com",
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
construction: {
|
|
36
|
+
type: "file",
|
|
37
|
+
name: "image",
|
|
38
|
+
label: "Picture",
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
]}
|
|
42
|
+
defaultValue={user}
|
|
43
|
+
submitControl={{
|
|
44
|
+
path: "me/update"
|
|
45
|
+
}}
|
|
46
|
+
onSuccess={() => {
|
|
47
|
+
router.push("/auth/me")
|
|
48
|
+
}}
|
|
49
|
+
footerControl={({loading}) => (
|
|
50
|
+
<>
|
|
51
|
+
<ButtonComponent
|
|
52
|
+
type="submit"
|
|
53
|
+
label="Save Changes"
|
|
54
|
+
block
|
|
55
|
+
className="mt-4"
|
|
56
|
+
loading={loading}
|
|
57
|
+
/>
|
|
58
|
+
</>
|
|
59
|
+
)}
|
|
60
|
+
/>
|
|
61
|
+
</CardComponent>
|
|
62
|
+
</div>
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
}
|
package/app/auth/login/page.tsx
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { useRouter } from "next/navigation";
|
|
4
|
-
import { ButtonComponent, CardComponent, FormSupervisionComponent } from "@components";
|
|
5
|
-
import { useAuthContext } from "@contexts";
|
|
6
|
-
import Link from "next/link";
|
|
7
|
-
|
|
8
|
-
export default function Login() {
|
|
9
|
-
const router = useRouter();
|
|
10
|
-
const {setAccessToken,setUser} = useAuthContext();
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<>
|
|
14
|
-
<div className="h-screen flex flex-col justify-center items-center">
|
|
15
|
-
<h1 className="text-2xl font-extrabold italic">WELCOME TO NEXT-LIGHT v.3</h1>
|
|
16
|
-
<p className="text-sm font-semibold mt-6">Sign in with your account!</p>
|
|
17
|
-
|
|
18
|
-
<CardComponent className="mt-4 p-6 w-[400px] rounded-2xl">
|
|
19
|
-
<FormSupervisionComponent
|
|
20
|
-
fields={[
|
|
21
|
-
{
|
|
22
|
-
construction: {
|
|
23
|
-
name: "email",
|
|
24
|
-
label: "E-mail",
|
|
25
|
-
placeholder: "Ex: example@mail.com",
|
|
26
|
-
validations: "required|min:10|max:50|email"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
construction: {
|
|
31
|
-
type: "password",
|
|
32
|
-
name: "password",
|
|
33
|
-
label: "Password",
|
|
34
|
-
placeholder: "Ex: secret123",
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
]}
|
|
38
|
-
submitControl={{
|
|
39
|
-
path: "login"
|
|
40
|
-
}}
|
|
41
|
-
onSuccess={(res) => {
|
|
42
|
-
setAccessToken(res?.data?.token)
|
|
43
|
-
setUser(res?.data?.user)
|
|
44
|
-
router.push("/auth/me")
|
|
45
|
-
}}
|
|
46
|
-
footerControl={() => (
|
|
47
|
-
<>
|
|
48
|
-
<ButtonComponent
|
|
49
|
-
type="submit"
|
|
50
|
-
label="Login Now"
|
|
51
|
-
block
|
|
52
|
-
className="mt-4"
|
|
53
|
-
/>
|
|
54
|
-
|
|
55
|
-
<p className="mt-4 text-center">Don't have an account yet? <Link href="/auth/register" className="text-primary underline">Create Account</Link></p>
|
|
56
|
-
</>
|
|
57
|
-
)}
|
|
58
|
-
/>
|
|
59
|
-
</CardComponent>
|
|
60
|
-
</div>
|
|
61
|
-
</>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useRouter } from "next/navigation";
|
|
4
|
+
import { ButtonComponent, CardComponent, FormSupervisionComponent } from "@components";
|
|
5
|
+
import { useAuthContext } from "@contexts";
|
|
6
|
+
import Link from "next/link";
|
|
7
|
+
|
|
8
|
+
export default function Login() {
|
|
9
|
+
const router = useRouter();
|
|
10
|
+
const {setAccessToken,setUser} = useAuthContext();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<div className="h-screen flex flex-col justify-center items-center">
|
|
15
|
+
<h1 className="text-2xl font-extrabold italic">WELCOME TO NEXT-LIGHT v.3</h1>
|
|
16
|
+
<p className="text-sm font-semibold mt-6">Sign in with your account!</p>
|
|
17
|
+
|
|
18
|
+
<CardComponent className="mt-4 p-6 w-[400px] rounded-2xl">
|
|
19
|
+
<FormSupervisionComponent
|
|
20
|
+
fields={[
|
|
21
|
+
{
|
|
22
|
+
construction: {
|
|
23
|
+
name: "email",
|
|
24
|
+
label: "E-mail",
|
|
25
|
+
placeholder: "Ex: example@mail.com",
|
|
26
|
+
validations: "required|min:10|max:50|email"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
construction: {
|
|
31
|
+
type: "password",
|
|
32
|
+
name: "password",
|
|
33
|
+
label: "Password",
|
|
34
|
+
placeholder: "Ex: secret123",
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
]}
|
|
38
|
+
submitControl={{
|
|
39
|
+
path: "login"
|
|
40
|
+
}}
|
|
41
|
+
onSuccess={(res) => {
|
|
42
|
+
setAccessToken(res?.data?.token)
|
|
43
|
+
setUser(res?.data?.user)
|
|
44
|
+
router.push("/auth/me")
|
|
45
|
+
}}
|
|
46
|
+
footerControl={() => (
|
|
47
|
+
<>
|
|
48
|
+
<ButtonComponent
|
|
49
|
+
type="submit"
|
|
50
|
+
label="Login Now"
|
|
51
|
+
block
|
|
52
|
+
className="mt-4"
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
<p className="mt-4 text-center">Don't have an account yet? <Link href="/auth/register" className="text-primary underline">Create Account</Link></p>
|
|
56
|
+
</>
|
|
57
|
+
)}
|
|
58
|
+
/>
|
|
59
|
+
</CardComponent>
|
|
60
|
+
</div>
|
|
61
|
+
</>
|
|
62
|
+
);
|
|
63
|
+
}
|