@necrolab/dashboard 0.4.57 → 0.4.59

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.
@@ -272,9 +272,9 @@ const saveProfile = async (profile) => {
272
272
  };
273
273
 
274
274
  const deleteProfile = async (profile) => {
275
- const { _id } = profile;
276
- Bot.Profiles = Bot.Profiles.filter((p) => p._id !== profile._id);
277
- pushWSUpdate({ event: "delete-profile", profile: { _id: _id } });
275
+ const { id } = profile;
276
+ Bot.Profiles = Bot.Profiles.filter((p) => p.id !== profile.id);
277
+ pushWSUpdate({ event: "delete-profile", profile: { id } });
278
278
  };
279
279
 
280
280
  async function handleWebsocketMessage(msg) {
@@ -1,7 +1,7 @@
1
1
  const users = [
2
2
  {
3
3
  event: "auth",
4
- _id: "641a5292b561088b64fe390b",
4
+ id: "641a5292b561088b64fe390b",
5
5
  name: "Admin",
6
6
  password: "admin",
7
7
  profilePicture: "https://cdn.discordapp.com/avatars/435549216304267264/6cfd74ad7c5939a0bcbf218aa08be8cb.png",
@@ -13,7 +13,7 @@ const users = [
13
13
  ];
14
14
 
15
15
  const profile = {
16
- _id: "645a82606ef8b7201b728805",
16
+ id: "645a82606ef8b7201b728805",
17
17
  enabled: false,
18
18
  profileName: "Master US 43725 [admin]",
19
19
  address: "88081 Piper Ways",
@@ -34,14 +34,14 @@ const profile = {
34
34
  };
35
35
 
36
36
  const profiles = [];
37
- for (let i = 0; i < 1000; i++) profiles.push({ ...profile, _id: i });
37
+ for (let i = 0; i < 1000; i++) profiles.push({ ...profile, id: i });
38
38
 
39
39
  export { users, profiles };
40
40
 
41
41
  export const tmAccounts = [
42
42
  {
43
43
  tags: ["admin"],
44
- _id: 1,
44
+ id: 1,
45
45
  password: "123",
46
46
  email: "tm@tm.com"
47
47
  }
@@ -50,7 +50,7 @@ export const tmAccounts = [
50
50
  export const axsAccounts = [
51
51
  {
52
52
  tags: ["admin"],
53
- _id: 2,
53
+ id: 2,
54
54
  password: "123",
55
55
  email: "axs@axs.com"
56
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@necrolab/dashboard",
3
- "version": "0.4.57",
3
+ "version": "0.4.59",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "rm -rf dist && npx workbox-cli generateSW workbox-config.cjs && vite build",
@@ -15,7 +15,7 @@
15
15
  "dependencies": {
16
16
  "@faker-js/faker": "^7.6.0",
17
17
  "@msgpack/msgpack": "^3.0.0-beta2",
18
- "@necrolab/tm-renderer": "^0.1.11",
18
+ "@necrolab/tm-renderer": "^0.1.12",
19
19
  "@vitejs/plugin-vue": "^5.2.1",
20
20
  "@vueuse/core": "^11.3.0",
21
21
  "autoprefixer": "^10.4.21",
@@ -1,185 +1,173 @@
1
1
  <template>
2
- <Row
3
- class="relative text-white grid-cols-5 md:grid-cols-7 h-16"
4
- @click="ui.setOpenContextMenu('')"
5
- @click.right.prevent="ui.setOpenContextMenu('')"
6
- >
7
- <div class="col-span-3 lg:col-span-2 flex">
8
- <Checkbox
9
- class="ml-0 mr-4"
10
- :toggled="props.account.selected"
11
- @valueUpdate="ui.toggleAccountSelected(props.account._id)"
12
- />
13
- <h4 class="mx-auto text-white" @click="copy(props.account.email)">
14
- {{ props.account.email }}
15
- </h4>
16
- </div>
17
- <div class="col-span-2 hidden md:block" @click="copy(props.account.password)">
18
- <h4 class="text-white">
19
- {{
20
- props.account.privacy
21
- ? "•".repeat(props.account.password.length)
22
- : props.account.password
23
- }}
24
- </h4>
25
- </div>
26
- <div class="col-span-1">
27
- <h4 v-if="props.account.enabled" class="text-green-400 flex justify-center">
28
- <img class="w-3 h-3 green" src="/img/controls/enable.svg" />
29
- </h4>
30
- <h4 v-else class="text-red-400 flex justify-center">
31
- <img class="w-3 h-3 fill-red-400" src="/img/close.svg" />
32
- </h4>
33
- </div>
34
-
35
- <div class="col-span-1 hidden lg:block">
36
- <h4 class="text-white flex justify-center gap-1">
37
- <TagLabel v-for="tag in props.account.tags" :key="tag" :text="tag" />
38
- </h4>
39
- </div>
40
-
41
- <div class="col-span-1 flex">
42
- <ul class="account-buttons">
43
- <li>
44
- <button @click="edit">
45
- <EditIcon />
46
- </button>
47
- </li>
48
- <li v-if="props.account.enabled">
49
- <button @click="disable">
50
- <img class="w-4 h-4" src="/img/controls/disable.svg" />
51
- </button>
52
- </li>
53
- <li v-else>
54
- <button @click="enable">
55
- <img class="w-4 h-4" src="/img/controls/enable.svg" />
56
- </button>
57
- </li>
58
- </ul>
59
- </div>
60
- </Row>
2
+ <Row
3
+ class="relative h-16 grid-cols-5 text-white md:grid-cols-7"
4
+ @click="ui.setOpenContextMenu('')"
5
+ @click.right.prevent="ui.setOpenContextMenu('')">
6
+ <div class="col-span-3 flex lg:col-span-2">
7
+ <Checkbox
8
+ class="ml-0 mr-4"
9
+ :toggled="props.account.selected"
10
+ @valueUpdate="ui.toggleAccountSelected(props.account.id)" />
11
+ <h4 class="mx-auto text-white" @click="copy(props.account.email)">
12
+ {{ props.account.email }}
13
+ </h4>
14
+ </div>
15
+ <div class="col-span-2 hidden md:block" @click="copy(props.account.password)">
16
+ <h4 class="text-white">
17
+ {{ props.account.privacy ? "".repeat(props.account.password.length) : props.account.password }}
18
+ </h4>
19
+ </div>
20
+ <div class="col-span-1">
21
+ <h4 v-if="props.account.enabled" class="flex justify-center text-green-400">
22
+ <img class="green h-3 w-3" src="/img/controls/enable.svg" />
23
+ </h4>
24
+ <h4 v-else class="flex justify-center text-red-400">
25
+ <img class="h-3 w-3 fill-red-400" src="/img/close.svg" />
26
+ </h4>
27
+ </div>
28
+
29
+ <div class="col-span-1 hidden lg:block">
30
+ <h4 class="flex justify-center gap-1 text-white">
31
+ <TagLabel v-for="tag in props.account.tags" :key="tag" :text="tag" />
32
+ </h4>
33
+ </div>
34
+
35
+ <div class="col-span-1 flex">
36
+ <ul class="account-buttons">
37
+ <li>
38
+ <button @click="edit">
39
+ <EditIcon />
40
+ </button>
41
+ </li>
42
+ <li v-if="props.account.enabled">
43
+ <button @click="disable">
44
+ <img class="h-4 w-4" src="/img/controls/disable.svg" />
45
+ </button>
46
+ </li>
47
+ <li v-else>
48
+ <button @click="enable">
49
+ <img class="h-4 w-4" src="/img/controls/enable.svg" />
50
+ </button>
51
+ </li>
52
+ </ul>
53
+ </div>
54
+ </Row>
61
55
  </template>
62
56
  <style lang="scss" scoped>
63
57
  h4 {
64
- @apply text-center;
58
+ @apply text-center;
65
59
  }
66
60
  .account-buttons {
67
- @apply flex items-center justify-center mx-auto bg-dark-500 border border-dark-650 rounded;
68
- padding: 3px;
69
- gap: 2px;
70
-
71
- button {
72
- @apply flex items-center justify-center transition-all duration-150 border-0 outline-0 relative rounded;
73
- background: transparent;
74
- width: 28px;
75
- height: 28px;
76
- color: #d0d0d3;
77
-
78
- &:hover {
79
- background: rgba(255, 255, 255, 0.1);
80
- color: #ffffff;
81
- transform: scale(1.05);
61
+ @apply mx-auto flex items-center justify-center rounded border border-dark-650 bg-dark-500;
62
+ padding: 3px;
63
+ gap: 2px;
64
+
65
+ button {
66
+ @apply relative flex items-center justify-center rounded border-0 outline-0 transition-all duration-150;
67
+ background: transparent;
68
+ width: 28px;
69
+ height: 28px;
70
+ color: #d0d0d3;
71
+
72
+ &:hover {
73
+ background: rgba(255, 255, 255, 0.1);
74
+ color: #ffffff;
75
+ transform: scale(1.05);
76
+ }
77
+
78
+ &:active {
79
+ background: rgba(255, 255, 255, 0.2);
80
+ transform: scale(0.95);
81
+ }
82
+ }
83
+
84
+ svg,
85
+ img {
86
+ width: 16px;
87
+ height: 16px;
88
+ position: relative;
89
+ z-index: 1;
82
90
  }
83
91
 
84
- &:active {
85
- background: rgba(255, 255, 255, 0.2);
86
- transform: scale(0.95);
92
+ svg path {
93
+ fill: currentColor;
87
94
  }
88
- }
89
-
90
- svg,
91
- img {
92
- width: 16px;
93
- height: 16px;
94
- position: relative;
95
- z-index: 1;
96
- }
97
-
98
- svg path {
99
- fill: currentColor;
100
- }
101
95
  }
102
96
 
103
97
  // Tablet optimization
104
98
  @media (max-width: 1024px) {
105
- h4 {
106
- font-size: 10px !important;
107
- }
99
+ h4 {
100
+ font-size: 10px !important;
101
+ }
108
102
 
109
- .account-buttons {
110
- padding: 3px;
111
- gap: 2px;
103
+ .account-buttons {
104
+ padding: 3px;
105
+ gap: 2px;
112
106
 
113
- button {
114
- width: 26px;
115
- height: 26px;
116
- }
107
+ button {
108
+ width: 26px;
109
+ height: 26px;
110
+ }
117
111
 
118
- svg,
119
- img {
120
- width: 14px;
121
- height: 14px;
112
+ svg,
113
+ img {
114
+ width: 14px;
115
+ height: 14px;
116
+ }
122
117
  }
123
- }
124
118
 
125
- .account-id {
126
- font-size: 6px !important;
127
- margin-right: -12px;
128
- margin-top: 20px;
129
- }
119
+ .account-id {
120
+ font-size: 6px !important;
121
+ margin-right: -12px;
122
+ margin-top: 20px;
123
+ }
130
124
  }
131
125
 
132
126
  // Mobile optimization
133
127
  @media (max-width: 768px) {
134
- .account-buttons {
135
- padding: 2px;
136
- gap: 1px;
137
-
138
- button {
139
- width: 22px;
140
- height: 22px;
141
- }
142
-
143
- svg,
144
- img {
145
- width: 12px;
146
- height: 12px;
128
+ .account-buttons {
129
+ padding: 2px;
130
+ gap: 1px;
131
+
132
+ button {
133
+ width: 22px;
134
+ height: 22px;
135
+ }
136
+
137
+ svg,
138
+ img {
139
+ width: 12px;
140
+ height: 12px;
141
+ }
147
142
  }
148
- }
149
143
  }
150
144
 
151
145
  // iPhone vertical (portrait) specific
152
146
  @media (max-width: 480px) and (orientation: portrait) {
153
- .account-buttons {
154
- padding: 2px;
155
- gap: 1px;
156
-
157
- button {
158
- width: 18px;
159
- height: 18px;
160
-
161
- &:hover {
162
- transform: scale(1.1);
163
- }
164
- }
165
-
166
- svg,
167
- img {
168
- width: 10px;
169
- height: 10px;
147
+ .account-buttons {
148
+ padding: 2px;
149
+ gap: 1px;
150
+
151
+ button {
152
+ width: 18px;
153
+ height: 18px;
154
+
155
+ &:hover {
156
+ transform: scale(1.1);
157
+ }
158
+ }
159
+
160
+ svg,
161
+ img {
162
+ width: 10px;
163
+ height: 10px;
164
+ }
170
165
  }
171
- }
172
166
  }
173
167
  </style>
174
168
  <script setup>
175
169
  import { Row } from "@/components/Table";
176
- import {
177
- PlayIcon,
178
- TrashIcon,
179
- BagWhiteIcon,
180
- PauseIcon,
181
- EditIcon,
182
- } from "@/components/icons";
170
+ import { PlayIcon, TrashIcon, BagWhiteIcon, PauseIcon, EditIcon } from "@/components/icons";
183
171
  import Checkbox from "@/components/ui/controls/atomic/Checkbox.vue";
184
172
  import { useUIStore } from "@/stores/ui";
185
173
  import TagLabel from "@/components/Editors/TagLabel.vue";
@@ -187,18 +175,18 @@ import TagLabel from "@/components/Editors/TagLabel.vue";
187
175
  const ui = useUIStore();
188
176
 
189
177
  const props = defineProps({
190
- account: { type: Object },
178
+ account: { type: Object }
191
179
  });
192
180
 
193
181
  const copy = (txt) => {
194
- if (!txt) return;
195
- navigator.clipboard.writeText(txt);
196
- ui.showSuccess("Copied text");
182
+ if (!txt) return;
183
+ navigator.clipboard.writeText(txt);
184
+ ui.showSuccess("Copied text");
197
185
  };
198
186
  const enable = async () => await ui.addAccount({ ...props.account, enabled: true });
199
187
  const disable = async () => await ui.addAccount({ ...props.account, enabled: false });
200
188
  const edit = () => {
201
- ui.currentlyEditing = props.account;
202
- ui.toggleModal("create-account");
189
+ ui.currentlyEditing = props.account;
190
+ ui.toggleModal("create-account");
203
191
  };
204
192
  </script>
@@ -1,37 +1,37 @@
1
1
  <template>
2
2
  <Table>
3
- <Header class="text-center grid-cols-5 md:grid-cols-7 sticky top-0 bg-dark-400 z-10">
4
- <div class="lg:col-span-2 col-span-3 flex">
3
+ <Header class="sticky top-0 z-10 grid-cols-5 bg-dark-400 text-center md:grid-cols-7">
4
+ <div class="col-span-3 flex lg:col-span-2">
5
5
  <Checkbox
6
6
  class="mr-3"
7
7
  :toggled="ui.mainCheckbox.accounts"
8
8
  @valueUpdate="ui.toggleMainCheckbox('accounts')"
9
9
  :isHeader="true" />
10
10
  <div class="mx-auto flex items-center" @click="ui.toggleSort('eventId')">
11
- <MailIcon class="mr-0 md:mr-3 w-4 h-4" />
11
+ <MailIcon class="mr-0 h-4 w-4 md:mr-3" />
12
12
  <h4 class="hidden md:flex">Email</h4>
13
13
  </div>
14
14
  </div>
15
- <div class="col-span-2 items-center justify-center hidden md:flex" v-once>
16
- <KeyIcon class="mr-0 md:mr-3 w-4 h-4" />
15
+ <div class="col-span-2 hidden items-center justify-center md:flex" v-once>
16
+ <KeyIcon class="mr-0 h-4 w-4 md:mr-3" />
17
17
  <h4 class="hidden md:flex">Password</h4>
18
18
  </div>
19
19
  <div class="col-span-1 flex items-center justify-center" v-once>
20
- <CheckmarkIcon class="mr-0 md:mr-3 w-4 h-4" />
20
+ <CheckmarkIcon class="mr-0 h-4 w-4 md:mr-3" />
21
21
  <h4 class="hidden md:flex">Enabled</h4>
22
22
  </div>
23
- <div class="col-span-1 hidden lg:flex items-center justify-center" v-once>
24
- <TicketIcon class="mr-0 md:mr-3 w-4 h-4" />
23
+ <div class="col-span-1 hidden items-center justify-center lg:flex" v-once>
24
+ <TicketIcon class="mr-0 h-4 w-4 md:mr-3" />
25
25
  <h4 class="hidden md:flex">Tags</h4>
26
26
  </div>
27
27
  <div class="col-span-1 flex items-center justify-center" v-once>
28
- <ClickIcon class="mr-0 md:mr-3 w-4 h-4" />
28
+ <ClickIcon class="mr-0 h-4 w-4 md:mr-3" />
29
29
  <h4 class="hidden md:flex">Actions</h4>
30
30
  </div>
31
31
  </Header>
32
32
  <div
33
33
  v-if="toRender.length != 0"
34
- class="overflow-y-auto hidden-scrollbars overflow-x-hidden stop-pan"
34
+ class="hidden-scrollbars stop-pan overflow-y-auto overflow-x-hidden"
35
35
  :style="{ maxHeight: dynamicTableHeight }">
36
36
  <RecycleScroller
37
37
  :items="toRender"
@@ -39,7 +39,7 @@
39
39
  key-field="index"
40
40
  class="scroller vue-recycle-scroller ready direction-vertical flex flex-col divide-y divide-dark-650">
41
41
  <template #default="props">
42
- <div class="account" :key="`account-${props.item._id || props.item.index}`">
42
+ <div class="account" :key="`account-${props.item.id || props.item.index}`">
43
43
  <Account
44
44
  @click="i[props.item.index]++"
45
45
  :class="props.item.index % 2 == 1 ? 'table-row-even' : 'table-row-odd'"
@@ -48,10 +48,10 @@
48
48
  </template>
49
49
  </RecycleScroller>
50
50
  </div>
51
- <div v-else class="flex flex-col items-center justify-center py-8 bg-dark-400 empty-state text-center">
52
- <MailIcon class="w-12 h-12 text-dark-400 mb-3 opacity-50" />
53
- <p class="text-light-400 text-sm">No accounts found</p>
54
- <p class="text-light-500 text-xs mt-1">Create accounts to get started</p>
51
+ <div v-else class="empty-state flex flex-col items-center justify-center bg-dark-400 py-8 text-center">
52
+ <MailIcon class="mb-3 h-12 w-12 text-dark-400 opacity-50" />
53
+ <p class="text-sm text-light-400">No accounts found</p>
54
+ <p class="mt-1 text-xs text-light-500">Create accounts to get started</p>
55
55
  </div>
56
56
  </Table>
57
57
  </template>
@@ -102,8 +102,8 @@ const toRender = computed(() => {
102
102
 
103
103
  // Initialize reactive refs for click tracking
104
104
  rendered.forEach((t) => {
105
- if (t._id && !(t._id in i.value)) {
106
- i.value[t._id] = 0;
105
+ if (t.id && !(t.id in i.value)) {
106
+ i.value[t.id] = 0;
107
107
  }
108
108
  if (!(t.index in i.value)) {
109
109
  i.value[t.index] = 0;
@@ -1,45 +1,45 @@
1
1
  <template>
2
2
  <Row
3
- class="relative text-white grid-cols-7 lg:grid-cols-8"
3
+ class="relative grid-cols-7 text-white lg:grid-cols-8"
4
4
  @click="ui.setOpenContextMenu('')"
5
- @click.right.prevent="ui.setOpenContextMenu('')"
6
- >
7
- <div class="col-span-3 lg:col-span-2 flex">
5
+ @click.right.prevent="ui.setOpenContextMenu('')">
6
+ <div class="col-span-3 flex lg:col-span-2">
8
7
  <Checkbox
9
8
  class="ml-0 mr-4"
10
9
  :toggled="props.profile.selected"
11
- @valueUpdate="ui.toggleProfileSelected(props.profile._id)"
12
- />
10
+ @valueUpdate="ui.toggleProfileSelected(props.profile.id)" />
13
11
  <h4 class="mx-auto text-white">
14
12
  {{ props.profile.profileName }}
15
13
  </h4>
16
14
  </div>
17
15
  <div class="col-span-1 lg:col-span-2">
18
- <h4 class="text-white flex justify-center items-center gap-2">
19
- <span class="hidden sm:block">{{
20
- props.profile.privacy
21
- ? props.profile.cardNumber[0] +
22
- "•".repeat(props.profile.cardNumber.length - 5) +
23
- props.profile.cardNumber.slice(-4)
24
- : validateCard(props.profile.cardNumber).formatted
25
- }}</span>
26
- <img class="w-6 h-6" :src="getAccountType()" />
16
+ <h4 class="flex items-center justify-center gap-2 text-white">
17
+ <span class="hidden sm:block">
18
+ {{
19
+ props.profile.privacy
20
+ ? props.profile.cardNumber[0] +
21
+ "•".repeat(props.profile.cardNumber.length - 5) +
22
+ props.profile.cardNumber.slice(-4)
23
+ : validateCard(props.profile.cardNumber).formatted
24
+ }}
25
+ </span>
26
+ <img class="h-6 w-6" :src="getAccountType()" />
27
27
  </h4>
28
28
  </div>
29
29
  <div class="col-span-1">
30
30
  <h4 class="text-white">{{ expDate() }}</h4>
31
31
  </div>
32
32
  <div class="col-span-1">
33
- <h4 v-if="props.profile.enabled" class="text-green-400 flex justify-center">
34
- <img class="w-3 h-3 green" src="/img/controls/enable.svg" />
33
+ <h4 v-if="props.profile.enabled" class="flex justify-center text-green-400">
34
+ <img class="green h-3 w-3" src="/img/controls/enable.svg" />
35
35
  </h4>
36
- <h4 v-else class="text-red-400 flex justify-center">
37
- <img class="w-3 h-3 fill-red-400" src="/img/close.svg" />
36
+ <h4 v-else class="flex justify-center text-red-400">
37
+ <img class="h-3 w-3 fill-red-400" src="/img/close.svg" />
38
38
  </h4>
39
39
  </div>
40
40
 
41
41
  <div class="col-span-1 hidden lg:block">
42
- <h4 class="text-white flex justify-center gap-1">
42
+ <h4 class="flex justify-center gap-1 text-white">
43
43
  <TagLabel v-for="tag in props.profile.tags" :key="tag" :text="tag" />
44
44
  </h4>
45
45
  </div>
@@ -53,12 +53,12 @@
53
53
  </li>
54
54
  <li v-if="props.profile.enabled">
55
55
  <button @click="disable">
56
- <img class="w-4 h-4" src="/img/controls/disable.svg" />
56
+ <img class="h-4 w-4" src="/img/controls/disable.svg" />
57
57
  </button>
58
58
  </li>
59
59
  <li v-else>
60
60
  <button @click="enable">
61
- <img class="w-4 h-4" src="/img/controls/enable.svg" />
61
+ <img class="h-4 w-4" src="/img/controls/enable.svg" />
62
62
  </button>
63
63
  </li>
64
64
  <li>
@@ -77,12 +77,12 @@ h4 {
77
77
  @apply text-center;
78
78
  }
79
79
  .profile-buttons {
80
- @apply flex items-center justify-center mx-auto bg-dark-500 border border-dark-650 rounded;
80
+ @apply mx-auto flex items-center justify-center rounded border border-dark-650 bg-dark-500;
81
81
  padding: 3px;
82
82
  gap: 2px;
83
83
 
84
84
  button {
85
- @apply flex items-center justify-center transition-all duration-150 border-0 outline-0 relative rounded;
85
+ @apply relative flex items-center justify-center rounded border-0 outline-0 transition-all duration-150;
86
86
  background: transparent;
87
87
  width: 28px;
88
88
  height: 28px;
@@ -200,8 +200,10 @@ const props = defineProps({
200
200
 
201
201
  const getAccountType = () => {
202
202
  var cn = props.profile.cardNumber;
203
- if (cn.startsWith("4")) return `/img/banks/visa.svg`; // visa
204
- else if (cn.startsWith("3")) return `/img/banks/amex.svg`; // amex
203
+ if (cn.startsWith("4"))
204
+ return `/img/banks/visa.svg`; // visa
205
+ else if (cn.startsWith("3"))
206
+ return `/img/banks/amex.svg`; // amex
205
207
  else if (cn.startsWith("5")) return `/img/banks/mastercard.svg`; // master
206
208
  };
207
209
 
@@ -213,5 +215,5 @@ const edit = () => {
213
215
  ui.currentlyEditing = props.profile;
214
216
  ui.toggleModal("create-profile");
215
217
  };
216
- const deleteProfile = async () => await ui.deleteProfile(props.profile._id);
218
+ const deleteProfile = async () => await ui.deleteProfile(props.profile.id);
217
219
  </script>