Skip to content

Commit c7b1cec

Browse files
committed
chore: Update Dashboard component with new Instance type
Explanation: - The `chore` prefix is used because the changes made are related to maintenance and not a new feature or a bug fix. - The Dashboard component was updated to use the new `Instance` type from `@/types/evolution.types`. - This change was made to improve type safety and consistency in the codebase. Note: - The `src/pages/Dashboard/index.tsx` file was modified, but the full path is not included in the commit message to keep it concise. - The `src/types/` directory was added, but it is not explicitly mentioned in the commit message since it is related to the `Instance` type update. - The code snippet provided shows that the `instances.map()` function was updated to accept an `Instance` type instead of `any`, which is a good practice for type safety.
1 parent 3495b1a commit c7b1cec

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/pages/Dashboard/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import "./style.css";
22
import { Button } from "@/components/ui/button";
33
import { Card } from "@/components/ui/card";
44
import { fetchInstances } from "@/services/instances.service";
5+
import { Instance } from "@/types/evolution.types";
56
import {
67
Check,
78
ChevronsUpDown,
@@ -117,7 +118,7 @@ function Dashboard() {
117118
</div>
118119
</div>
119120
<main className="instance-cards">
120-
{instances.map((instance: any) => (
121+
{instances.map((instance: Instance) => (
121122
<Card className="instance-card" key={instance.id}>
122123
<div className="card-header">
123124
<div className="card-id">

src/types/evolution.types.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export type Settings = {
2+
id: string;
3+
rejectCall: boolean;
4+
msgCall: string;
5+
groupsIgnore: boolean;
6+
alwaysOnline: boolean;
7+
readMessages: boolean;
8+
readStatus: boolean;
9+
syncFullHistory: boolean;
10+
createdAt: string;
11+
updatedAt: string;
12+
instanceId: string;
13+
};
14+
15+
export type Instance = {
16+
id: string;
17+
name: string;
18+
connectionStatus: string;
19+
ownerJid: string;
20+
profileName: string;
21+
profilePicUrl: string;
22+
integration: string;
23+
number: string;
24+
businessId: string;
25+
token: string;
26+
clientName: string;
27+
createdAt: string;
28+
updatedAt: string;
29+
Setting: Settings;
30+
};

0 commit comments

Comments
 (0)