@axium/contacts 0.2.4 → 0.2.6
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { origin, userInfo } from '@axium/client';
|
|
3
|
+
import UserPFP from '@axium/client/components/UserPFP';
|
|
2
4
|
import type { InitNoExternal } from '@axium/contacts';
|
|
3
|
-
import { colorHashRGB } from '@axium/core/color';
|
|
4
5
|
import { name as formatName } from '@axium/contacts/client/format';
|
|
5
|
-
import
|
|
6
|
-
import { userInfo } from '@axium/client';
|
|
6
|
+
import { colorHashRGB } from '@axium/core/color';
|
|
7
7
|
|
|
8
8
|
let { contact, isDefault = $bindable() }: { contact: InitNoExternal & { id: string }; isDefault?: boolean } = $props();
|
|
9
9
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</svg>`.replaceAll(/[\t\n]/g, '')
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
let src = $state(
|
|
18
|
+
let src = $state(`${origin}/raw/contacts/pfp/${contact.id}`);
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
{#if contact.linkedUserId}
|
package/lib/InitForm.svelte
CHANGED
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
{/snippet}
|
|
40
40
|
|
|
41
41
|
{#snippet add(field: ArrayField)}
|
|
42
|
-
{#if init[field].length}<span
|
|
42
|
+
{#if init[field].length}<span></span>{/if}
|
|
43
43
|
<button class="icon-text" onclick={() => init[field].push({} as any)}>
|
|
44
44
|
<Icon i="plus" />
|
|
45
45
|
<span>{text('contacts.init.add.' + field)}</span>
|
|
46
46
|
</button>
|
|
47
|
-
<span
|
|
47
|
+
<span></span>
|
|
48
48
|
{/snippet}
|
|
49
49
|
|
|
50
50
|
<div class="contact-init-actions">
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
|
|
72
72
|
<div class="contact-init">
|
|
73
73
|
<Icon i="user" />
|
|
74
|
+
|
|
74
75
|
<div class="section">
|
|
75
76
|
{@render zod('display', more.names, true)}
|
|
76
77
|
{@render zod('prefix', more.names, true)}
|
|
@@ -92,7 +93,7 @@
|
|
|
92
93
|
|
|
93
94
|
<Icon i="regular/envelope" />
|
|
94
95
|
{#each init.emails, i}
|
|
95
|
-
{#if i}<span
|
|
96
|
+
{#if i}<span></span>{/if}
|
|
96
97
|
<div class={['email', init.emails.length > 1 && 'with-label']}>
|
|
97
98
|
<ZodInput bind:rootValue={init} path="emails.{i}.email" schema={Email.shape.email} {updateValue} noLabel="placeholder" />
|
|
98
99
|
{#if init.emails.length > 1}
|
|
@@ -105,7 +106,7 @@
|
|
|
105
106
|
|
|
106
107
|
<Icon i="phone" />
|
|
107
108
|
{#each init.phones, i}
|
|
108
|
-
{#if i}<span
|
|
109
|
+
{#if i}<span></span>{/if}
|
|
109
110
|
<div class={['phone', init.phones.length > 1 && 'with-label']}>
|
|
110
111
|
<ZodInput bind:rootValue={init} path="phones.{i}.country" schema={Phone.shape.country} {updateValue} noLabel="placeholder" />
|
|
111
112
|
<ZodInput bind:rootValue={init} path="phones.{i}.number" schema={Phone.shape.number} {updateValue} noLabel="placeholder" />
|
|
@@ -119,7 +120,7 @@
|
|
|
119
120
|
|
|
120
121
|
<Icon i="regular/location-dot" />
|
|
121
122
|
{#each init.addresses, i}
|
|
122
|
-
{#if i}<span
|
|
123
|
+
{#if i}<span></span>{/if}
|
|
123
124
|
<div class="section">
|
|
124
125
|
<LocationSelect bind:value={init.addresses[i]} />
|
|
125
126
|
</div>
|
|
@@ -132,12 +133,12 @@
|
|
|
132
133
|
<div class="section">
|
|
133
134
|
<DateSelect bind:day={init.birthDay} bind:month={init.birthMonth} bind:year={init.birthYear} />
|
|
134
135
|
</div>
|
|
135
|
-
<span
|
|
136
|
+
<span></span>
|
|
136
137
|
|
|
137
138
|
{#if showDetailed}
|
|
138
139
|
<Icon i="regular/circle-nodes" />
|
|
139
140
|
{#each init.relationships as rel, i}
|
|
140
|
-
{#if i}<span
|
|
141
|
+
{#if i}<span></span>{/if}
|
|
141
142
|
<div class="section">
|
|
142
143
|
<Discovery
|
|
143
144
|
onSelect={result => (rel.to = result.contact.id)}
|
|
@@ -160,7 +161,7 @@
|
|
|
160
161
|
|
|
161
162
|
<Icon i="regular/calendar-day" />
|
|
162
163
|
{#each init.dates, i}
|
|
163
|
-
{#if i}<span
|
|
164
|
+
{#if i}<span></span>{/if}
|
|
164
165
|
<div class="section">
|
|
165
166
|
<ZodInput bind:rootValue={init} path="dates.{i}" schema={SigDate} {updateValue} noLabel="placeholder" />
|
|
166
167
|
</div>
|
|
@@ -170,7 +171,7 @@
|
|
|
170
171
|
|
|
171
172
|
<Icon i="link-simple" />
|
|
172
173
|
{#each init.urls, i}
|
|
173
|
-
{#if i}<span
|
|
174
|
+
{#if i}<span></span>{/if}
|
|
174
175
|
<div class="section">
|
|
175
176
|
<ZodInput bind:rootValue={init} path="urls.{i}" schema={ContactURL} {updateValue} noLabel="placeholder" />
|
|
176
177
|
</div>
|
|
@@ -180,7 +181,7 @@
|
|
|
180
181
|
|
|
181
182
|
<Icon i="regular/input-text" />
|
|
182
183
|
{#each init.custom, i}
|
|
183
|
-
{#if i}<span
|
|
184
|
+
{#if i}<span></span>{/if}
|
|
184
185
|
<div class="section">
|
|
185
186
|
<ZodInput bind:rootValue={init} path="custom.{i}" schema={Custom} {updateValue} noLabel="placeholder" />
|
|
186
187
|
</div>
|
|
@@ -191,15 +192,15 @@
|
|
|
191
192
|
|
|
192
193
|
<Icon i="regular/note" />
|
|
193
194
|
<textarea bind:value={init.notes} {@attach dynamicRows(50, 3)}></textarea>
|
|
194
|
-
<span
|
|
195
|
+
<span></span>
|
|
195
196
|
|
|
196
|
-
<span
|
|
197
|
+
<span></span>
|
|
197
198
|
<div>
|
|
198
199
|
<button onclick={() => (showDetailed = !showDetailed)}>
|
|
199
200
|
<span>{text('contacts.init.show_' + (showDetailed ? 'less' : 'more'))}</span>
|
|
200
201
|
</button>
|
|
201
202
|
</div>
|
|
202
|
-
<span
|
|
203
|
+
<span></span>
|
|
203
204
|
</div>
|
|
204
205
|
|
|
205
206
|
<style>
|
|
@@ -243,7 +244,8 @@
|
|
|
243
244
|
background-color: var(--bg-menu);
|
|
244
245
|
|
|
245
246
|
button.toggle {
|
|
246
|
-
height:
|
|
247
|
+
height: 2em;
|
|
248
|
+
padding: 0.5em 0;
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
:global(.ZodInput) {
|
|
@@ -251,6 +253,10 @@
|
|
|
251
253
|
flex-direction: column;
|
|
252
254
|
gap: 1em;
|
|
253
255
|
}
|
|
256
|
+
|
|
257
|
+
:global(& > .Icon) {
|
|
258
|
+
margin: 0.5em 0;
|
|
259
|
+
}
|
|
254
260
|
}
|
|
255
261
|
|
|
256
262
|
.section {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/contacts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"description": "Contacts for Axium",
|
|
6
6
|
"funding": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"build": "tsc"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@axium/client": ">=0.
|
|
41
|
+
"@axium/client": ">=0.25.0",
|
|
42
42
|
"@axium/core": ">=0.26.0",
|
|
43
43
|
"@axium/server": ">=0.43.0",
|
|
44
44
|
"@sveltejs/kit": "^2.27.3",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { fetchAPI, text } from '@axium/client';
|
|
2
|
+
import { fetchAPI, origin, text } from '@axium/client';
|
|
3
3
|
import { FormDialog, Icon, Popover } from '@axium/client/components';
|
|
4
4
|
import { toast, toastStatus } from '@axium/client/toast';
|
|
5
5
|
import { toVCard } from '@axium/contacts';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
async function updatePicture() {
|
|
16
16
|
try {
|
|
17
17
|
const file = await upload('image/*');
|
|
18
|
-
const response = await fetch(
|
|
18
|
+
const response = await fetch(`${origin}/raw/contacts/pfp/${contact.id}`, {
|
|
19
19
|
method: 'POST',
|
|
20
20
|
headers: { 'content-type': file.type, 'content-length': file.size.toString() },
|
|
21
21
|
body: file,
|
|
@@ -95,7 +95,10 @@
|
|
|
95
95
|
<div
|
|
96
96
|
class="menu-item"
|
|
97
97
|
onclick={() =>
|
|
98
|
-
toastStatus(
|
|
98
|
+
toastStatus(
|
|
99
|
+
fetch(`${origin}/raw/contacts/pfp/${contact.id}`, { method: 'DELETE' }),
|
|
100
|
+
text('contacts.image.toast_removed')
|
|
101
|
+
)}
|
|
99
102
|
>
|
|
100
103
|
<Icon i="trash" />
|
|
101
104
|
<span>{text('contacts.image.remove')}</span>
|
|
@@ -247,15 +250,15 @@
|
|
|
247
250
|
border-radius: 1em;
|
|
248
251
|
background-color: var(--bg-menu);
|
|
249
252
|
|
|
250
|
-
button.toggle {
|
|
251
|
-
height: 1em;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
253
|
:global(.ZodInput) {
|
|
255
254
|
display: flex;
|
|
256
255
|
flex-direction: column;
|
|
257
256
|
gap: 1em;
|
|
258
257
|
}
|
|
258
|
+
|
|
259
|
+
:global(& > .Icon) {
|
|
260
|
+
margin: 0.25em 0;
|
|
261
|
+
}
|
|
259
262
|
}
|
|
260
263
|
|
|
261
264
|
.section {
|