@nymphjs/tilmeld-setup 1.0.0-beta.13 → 1.0.0-beta.130

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.
@@ -0,0 +1,203 @@
1
+ {#if $clientConfig == null || $user == null}
2
+ <section>
3
+ <div style="display: flex; justify-content: center; align-items: center;">
4
+ <CircularProgress style="height: 45px; width: 45px;" indeterminate />
5
+ </div>
6
+ </section>
7
+ {:else}
8
+ <div class="solo-search-container solo-container">
9
+ <Fab
10
+ href="/users/edit/+"
11
+ use={[link]}
12
+ color="primary"
13
+ mini
14
+ class="solo-fab"
15
+ title="New User"
16
+ >
17
+ <Icon tag="svg" viewBox="0 0 24 24">
18
+ <path fill="currentColor" d={mdiPlus} />
19
+ </Icon>
20
+ </Fab>
21
+ <Paper class="solo-paper" elevation={6}>
22
+ <Icon class="solo-icon" tag="svg" viewBox="0 0 24 24">
23
+ <path fill="currentColor" d={mdiMagnify} />
24
+ </Icon>
25
+ <Input
26
+ bind:value={entitySearch}
27
+ onkeydown={entitySearchKeyDown}
28
+ placeholder="User Search"
29
+ class="solo-input"
30
+ />
31
+ </Paper>
32
+ <Fab
33
+ onclick={searchEntities}
34
+ disabled={entitySearch === ''}
35
+ color="primary"
36
+ mini
37
+ class="solo-fab"
38
+ title="Search"
39
+ >
40
+ <Icon tag="svg" viewBox="0 0 24 24">
41
+ <path fill="currentColor" d={mdiArrowRight} />
42
+ </Icon>
43
+ </Fab>
44
+ </div>
45
+ <section>
46
+ {#if failureMessage}
47
+ <div class="tilmeld-failure">
48
+ {failureMessage}
49
+ </div>
50
+ {/if}
51
+
52
+ {#if entitiesSearching}
53
+ <div style="display: flex; justify-content: center; align-items: center;">
54
+ <CircularProgress style="height: 32px; width: 32px;" indeterminate />
55
+ </div>
56
+ {:else if entities != null}
57
+ <DataTable table$aria-label="User list" style="width: 100%;">
58
+ <Head>
59
+ <Row>
60
+ {#if !$clientConfig.emailUsernames}
61
+ <Cell>Username</Cell>
62
+ {/if}
63
+ {#if $clientConfig.userFields.includes('name')}
64
+ <Cell>Name</Cell>
65
+ {/if}
66
+ {#if $clientConfig.userFields.includes('email')}
67
+ <Cell>Email</Cell>
68
+ {/if}
69
+ <Cell>Enabled</Cell>
70
+ </Row>
71
+ </Head>
72
+ <Body>
73
+ {#each entities as curEntity (curEntity.guid)}
74
+ <Row>
75
+ {#if !$clientConfig.emailUsernames}
76
+ <Cell
77
+ ><a
78
+ href="/users/edit/{encodeURIComponent(
79
+ curEntity.guid || '',
80
+ )}"
81
+ use:link>{curEntity.username}</a
82
+ ></Cell
83
+ >
84
+ {/if}
85
+ {#if $clientConfig.userFields.includes('name')}
86
+ <Cell
87
+ ><a
88
+ href="/users/edit/{encodeURIComponent(
89
+ curEntity.guid || '',
90
+ )}"
91
+ use:link>{curEntity.name}</a
92
+ ></Cell
93
+ >
94
+ {/if}
95
+ {#if $clientConfig.userFields.includes('email')}
96
+ <Cell
97
+ ><a
98
+ href="/users/edit/{encodeURIComponent(
99
+ curEntity.guid || '',
100
+ )}"
101
+ use:link>{curEntity.email}</a
102
+ ></Cell
103
+ >
104
+ {/if}
105
+ <Cell>{curEntity.enabled ? 'Yes' : 'No'}</Cell>
106
+ </Row>
107
+ {:else}
108
+ <Row>
109
+ <Cell
110
+ colspan={1 +
111
+ (!$clientConfig.emailUsernames ? 1 : 0) +
112
+ ($clientConfig.userFields.includes('name') ? 1 : 0) +
113
+ ($clientConfig.userFields.includes('email') ? 1 : 0)}
114
+ >None found.</Cell
115
+ >
116
+ </Row>
117
+ {/each}
118
+ </Body>
119
+ </DataTable>
120
+ {/if}
121
+ </section>
122
+ {/if}
123
+
124
+ <script lang="ts">
125
+ import type { Writable } from 'svelte/store';
126
+ import { getContext } from 'svelte';
127
+ import { link, push } from 'svelte-spa-router';
128
+ import queryParser from '@nymphjs/query-parser';
129
+ import type {
130
+ AdminUserData,
131
+ ClientConfig,
132
+ CurrentUserData,
133
+ } from '@nymphjs/tilmeld-client';
134
+ import type {
135
+ Group as GroupClass,
136
+ User as UserClass,
137
+ } from '@nymphjs/tilmeld-client';
138
+ import { mdiMagnify, mdiArrowRight, mdiPlus } from '@mdi/js';
139
+ import CircularProgress from '@smui/circular-progress';
140
+ import Paper from '@smui/paper';
141
+ import DataTable, { Head, Body, Row, Cell } from '@smui/data-table';
142
+ import { Input } from '@smui/textfield';
143
+ import Fab from '@smui/fab';
144
+ import { Icon } from '@smui/common';
145
+
146
+ import { nymph, User, Group } from '../nymph.js';
147
+
148
+ let { params }: { params: { query?: string } } = $props();
149
+
150
+ let entitySearch = $derived(params.query ?? '');
151
+ let failureMessage: string | undefined = $state();
152
+
153
+ const clientConfig =
154
+ getContext<Writable<ClientConfig | undefined>>('clientConfigStore');
155
+ const user =
156
+ getContext<Writable<(UserClass & CurrentUserData) | null | undefined>>(
157
+ 'userStore',
158
+ );
159
+
160
+ $effect(() => {
161
+ if (params) {
162
+ handleSearchParam();
163
+ }
164
+ });
165
+
166
+ async function handleSearchParam() {
167
+ if (params.query && params.query !== '') {
168
+ entitiesSearching = true;
169
+ failureMessage = undefined;
170
+ try {
171
+ const query = queryParser({
172
+ query: params.query,
173
+ entityClass: User,
174
+ defaultFields: ['username', 'name', 'email'],
175
+ qrefMap: {
176
+ User: {
177
+ class: User,
178
+ defaultFields: ['username', 'name', 'email'],
179
+ },
180
+ Group: {
181
+ class: Group,
182
+ defaultFields: ['groupname', 'name', 'email'],
183
+ },
184
+ },
185
+ });
186
+ entities = await nymph.getEntities(...query);
187
+ } catch (e: any) {
188
+ failureMessage = e?.message;
189
+ }
190
+ entitiesSearching = false;
191
+ }
192
+ }
193
+
194
+ let entitiesSearching = $state(false);
195
+ let entities: (UserClass & AdminUserData)[] | undefined = $state();
196
+ async function searchEntities() {
197
+ push(`/users/${encodeURIComponent(entitySearch)}`);
198
+ }
199
+ function entitySearchKeyDown(event: CustomEvent | KeyboardEvent) {
200
+ event = event as KeyboardEvent;
201
+ if (event.key === 'Enter') searchEntities();
202
+ }
203
+ </script>
@@ -1,8 +1,8 @@
1
1
  @use 'sass:color';
2
2
 
3
- @use '@material/theme/color-palette';
3
+ @use '@smui/common/theme/color-palette';
4
4
 
5
- @use '@material/theme/index' as theme with (
5
+ @use '@smui/common/theme/index' as theme with (
6
6
  $primary: #4260a6,
7
7
  $secondary: #f8d153,
8
8
  $surface: #fff,
@@ -12,7 +12,7 @@
12
12
 
13
13
  // Typography mixins.
14
14
  @use './helpers';
15
- @use '@material/typography/index' as typography with (
15
+ @use '@smui/common/typography/index' as typography with (
16
16
  $styles-headline1: (
17
17
  font-size: helpers.px-to-rem(60px),
18
18
  line-height: helpers.px-to-rem(60px),
@@ -40,10 +40,10 @@
40
40
  );
41
41
 
42
42
  // Import all the typography styles for the classes.
43
- @use '@material/typography/mdc-typography';
43
+ @use '@smui/common/typography/mdc-typography';
44
44
 
45
45
  // Main Top App Bar styling.
46
- @use '@material/top-app-bar/index' as top-app-bar;
46
+ @use '@smui/top-app-bar/styles' as top-app-bar;
47
47
  .mdc-top-app-bar.tilmeld-top-app-bar {
48
48
  // Position it above the drawer.
49
49
  z-index: 7;
@@ -0,0 +1,105 @@
1
+
2
+ .mdc-dialog .mdc-dialog__surface.tilmeld-password-dialog-surface {
3
+ width: 360px;
4
+ max-width: calc(100vw - 32px);
5
+ }
6
+ .tilmeld-password-failure.svelte-1oizvng {
7
+ margin-top: 1em;
8
+ color: var(--mdc-theme-error, #f00);
9
+ }
10
+ .tilmeld-password-loading.svelte-1oizvng {
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ }
15
+
16
+
17
+
18
+ .mdc-dialog .mdc-dialog__surface.tilmeld-revoke-tokens-dialog-surface
19
+ {
20
+ width: 360px;
21
+ max-width: calc(100vw - 32px);
22
+ }
23
+ .tilmeld-revoke-tokens-failure.svelte-1llryk7 {
24
+ margin-top: 1em;
25
+ color: var(--mdc-theme-error, #f00);
26
+ }
27
+ .tilmeld-revoke-tokens-loading.svelte-1llryk7 {
28
+ display: flex;
29
+ justify-content: center;
30
+ align-items: center;
31
+ }
32
+
33
+
34
+ .mdc-dialog .mdc-dialog__surface.tilmeld-two-factor-dialog-surface {
35
+ width: 400px;
36
+ max-width: calc(100vw - 32px);
37
+ }
38
+ .tilmeld-two-factor-failure.svelte-1bkes2m {
39
+ margin-top: 1em;
40
+ color: var(--mdc-theme-error, #f00);
41
+ }
42
+ .tilmeld-two-factor-loading.svelte-1bkes2m {
43
+ display: flex;
44
+ justify-content: center;
45
+ align-items: center;
46
+ }
47
+
48
+
49
+ .mdc-dialog .mdc-dialog__surface.tilmeld-account-dialog-surface {
50
+ width: 360px;
51
+ max-width: calc(100vw - 32px);
52
+ }
53
+ .tilmeld-account-failure.svelte-1g5qls0 {
54
+ margin-top: 1em;
55
+ color: var(--mdc-theme-error, #f00);
56
+ }
57
+ .tilmeld-account-action.svelte-1g5qls0 {
58
+ margin-top: 1em;
59
+ }
60
+ .tilmeld-account-loading.svelte-1g5qls0 {
61
+ display: flex;
62
+ justify-content: center;
63
+ align-items: center;
64
+ }
65
+
66
+
67
+ .mdc-dialog .mdc-dialog__surface.tilmeld-recover-dialog-surface {
68
+ width: 540px;
69
+ max-width: calc(100vw - 32px);
70
+ }
71
+ .tilmeld-recover-action.svelte-1b72kkn {
72
+ margin-top: 1em;
73
+ }
74
+ .tilmeld-recover-failure.svelte-1b72kkn {
75
+ margin-top: 1em;
76
+ color: var(--mdc-theme-error, #f00);
77
+ }
78
+ .tilmeld-recover-loading.svelte-1b72kkn {
79
+ display: flex;
80
+ justify-content: center;
81
+ align-items: center;
82
+ }
83
+
84
+
85
+ .tilmeld-login-buttons.svelte-1nt1tpa {
86
+ display: flex;
87
+ flex-direction: row;
88
+ justify-content: start;
89
+ align-items: center;
90
+ margin-top: 1em;
91
+ }
92
+ .tilmeld-login-action.svelte-1nt1tpa {
93
+ margin-top: 1em;
94
+ }
95
+ .tilmeld-login-failure.svelte-1nt1tpa {
96
+ margin-top: 1em;
97
+ color: var(--mdc-theme-error, #f00);
98
+ }
99
+
100
+
101
+ @media (max-width: 720px) {
102
+ * > .hide-initial-small {
103
+ display: none;
104
+ }
105
+ }