create-mana 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +28 -2
- package/bin/create-mana.mjs +5 -0
- package/kits/auth/files/src/api/auth.ts +100 -0
- package/kits/auth/files/src/api/profile.ts +48 -0
- package/kits/auth/files/src/api/types.ts +28 -0
- package/kits/auth/files/src/components/AppLayout.mana +31 -0
- package/kits/auth/files/src/components/VerifyBanner.mana +47 -0
- package/kits/auth/files/src/router/routes.ts +31 -0
- package/kits/auth/files/src/shared/events.ts +11 -0
- package/kits/auth/files/src/stores/session.ts +99 -0
- package/kits/auth/files/src/views/ForgotPassword.mana +83 -0
- package/kits/auth/files/src/views/Home.mana +15 -0
- package/kits/auth/files/src/views/Profile.mana +172 -0
- package/kits/auth/files/src/views/Register.mana +86 -0
- package/kits/auth/files/src/views/ResetPassword.mana +90 -0
- package/kits/auth/files/src/views/SignIn.mana +84 -0
- package/kits/auth/files/src/views/VerifyEmail.mana +78 -0
- package/kits/auth/files/tests/auth.test.mjs +93 -0
- package/kits/auth/files/tests/home.test.mjs +38 -0
- package/kits/auth/files/tests/profile.test.mjs +68 -0
- package/kits/auth/files/tests/support/users.mjs +2 -0
- package/kits/auth/kit.json +80 -0
- package/kits/base/files/README.md +39 -0
- package/kits/base/kit.json +7 -0
- package/kits/organisations/files/src/api/auth.ts +124 -0
- package/kits/organisations/files/src/api/members.ts +243 -0
- package/kits/organisations/files/src/api/notifications.ts +63 -0
- package/kits/organisations/files/src/api/organisations.ts +41 -0
- package/kits/organisations/files/src/api/scope.ts +98 -0
- package/kits/organisations/files/src/api/types.ts +72 -0
- package/kits/organisations/files/src/assets/styles/organisations.css +46 -0
- package/kits/organisations/files/src/components/AppLayout.mana +90 -0
- package/kits/organisations/files/src/components/NotificationBell.mana +35 -0
- package/kits/organisations/files/src/components/NotificationList.mana +112 -0
- package/kits/organisations/files/src/components/OrganisationSwitcher.mana +171 -0
- package/kits/organisations/files/src/composables/notifications.ts +28 -0
- package/kits/organisations/files/src/router/routes.ts +43 -0
- package/kits/organisations/files/src/shared/roles.ts +10 -0
- package/kits/organisations/files/src/stores/notifications.ts +41 -0
- package/kits/organisations/files/src/stores/session.ts +158 -0
- package/kits/organisations/files/src/utilities/format.ts +15 -0
- package/kits/organisations/files/src/views/Forbidden.mana +28 -0
- package/kits/organisations/files/src/views/Home.mana +15 -0
- package/kits/organisations/files/src/views/Invite.mana +156 -0
- package/kits/organisations/files/src/views/InviteMember.mana +99 -0
- package/kits/organisations/files/src/views/Members.mana +218 -0
- package/kits/organisations/files/src/views/NoOrganisation.mana +184 -0
- package/kits/organisations/files/src/views/Notifications.mana +30 -0
- package/kits/organisations/files/src/views/OrganisationForm.mana +76 -0
- package/kits/organisations/files/src/views/OrganisationSettings.mana +62 -0
- package/kits/organisations/files/src/views/Profile.mana +213 -0
- package/kits/organisations/files/src/views/Register.mana +113 -0
- package/kits/organisations/files/tests/auth.test.mjs +82 -0
- package/kits/organisations/files/tests/home.test.mjs +43 -0
- package/kits/organisations/files/tests/members.test.mjs +89 -0
- package/kits/organisations/files/tests/notifications.test.mjs +49 -0
- package/kits/organisations/files/tests/organisations.test.mjs +70 -0
- package/kits/organisations/files/tests/profile.test.mjs +79 -0
- package/kits/organisations/files/tests/support/users.mjs +3 -0
- package/kits/organisations/kit.json +51 -0
- package/lib/compose.mjs +209 -0
- package/lib/new.mjs +161 -0
- package/lib/prompts.mjs +182 -0
- package/package.json +36 -4
- package/template/.nvmrc +1 -0
- package/template/README.md +23 -0
- package/template/_gitignore +25 -0
- package/template/index.html +17 -0
- package/template/package.json +22 -0
- package/template/public/favicon.svg +1 -0
- package/template/public/icons.svg +24 -0
- package/template/src/App.mana +15 -0
- package/template/src/api/ApiError.ts +17 -0
- package/template/src/api/client.ts +116 -0
- package/template/src/assets/styles/main.css +158 -0
- package/template/src/components/AppLogo.mana +20 -0
- package/template/src/components/Button.mana +25 -0
- package/template/src/components/ConfirmHost.mana +43 -0
- package/template/src/components/TextField.mana +60 -0
- package/template/src/components/ToastHost.mana +40 -0
- package/template/src/composables/media.ts +19 -0
- package/template/src/composables/unsaved.ts +29 -0
- package/template/src/main.ts +25 -0
- package/template/src/router/index.ts +14 -0
- package/template/src/router/routes.ts +11 -0
- package/template/src/stores/confirm.ts +45 -0
- package/template/src/stores/toasts.ts +64 -0
- package/template/src/utilities/query.ts +40 -0
- package/template/src/utilities/timers.ts +12 -0
- package/template/src/views/Home.mana +12 -0
- package/template/src/views/NotFound.mana +13 -0
- package/template/tests/home.test.mjs +29 -0
- package/template/tests/support/api.mjs +44 -0
- package/template/tests/support/check.mjs +15 -0
- package/template/tests/support/dom.mjs +45 -0
- package/template/tests/support/paths.mjs +54 -0
- package/template/tests/support/settle.mjs +15 -0
- package/template/tsconfig.json +35 -0
- package/template/vite.config.ts +29 -0
- package/versions.json +3 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Organisations, from the API (the Coven starter's Organisations kit): its calls.
|
|
3
|
+
* createOrganisation a new organisation, which the user owns and works in from now on: the user as the API has them
|
|
4
|
+
* switchOrganisation works in another of the user's organisations: the user (404 for one they aren't in)
|
|
5
|
+
* organisationSettings an organisation's settings, for its owner and admins
|
|
6
|
+
* updateOrganisation saves them as a whole, and answers with them as they now are (422 on the field a refusal is about)
|
|
7
|
+
* Like members.ts's, the settings' calls are given the id of the organisation they're about, which the API puts in the path.
|
|
8
|
+
*/
|
|
9
|
+
import { userOf } from "@/api/auth";
|
|
10
|
+
import ApiError from "@/api/ApiError";
|
|
11
|
+
import { request } from "@/api/client";
|
|
12
|
+
import type { NewOrganisation, OrganisationInput, OrganisationSettings, User } from "@/api/types";
|
|
13
|
+
|
|
14
|
+
export async function createOrganisation(input: NewOrganisation): Promise<User> {
|
|
15
|
+
return userOf(await request("POST", "/organisations", { name: input.name }));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function switchOrganisation(id: number): Promise<User> {
|
|
19
|
+
return userOf(await request("PUT", "/user/organisation", { organisation: id }));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function organisationSettings(id: number): Promise<OrganisationSettings> {
|
|
23
|
+
return settingsOf(await request("GET", path(id)));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function updateOrganisation(id: number, input: OrganisationInput): Promise<OrganisationSettings> {
|
|
27
|
+
return settingsOf(await request("PATCH", path(id), { name: input.name }));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function path(id: number) {
|
|
31
|
+
return `/organisations/${id}/settings`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function settingsOf(data: unknown): OrganisationSettings {
|
|
35
|
+
const name = typeof data == "object" && data !== null ? Reflect.get(data, "name") : undefined;
|
|
36
|
+
|
|
37
|
+
if(typeof name != "string")
|
|
38
|
+
throw new ApiError("The API answered with settings this app can't read.");
|
|
39
|
+
|
|
40
|
+
return { name };
|
|
41
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* What the calls to an organisation's data share: the organisation the user is working in, whose id the API puts in the path (`/organisations/{id}/…`), and the way across between the API's words and
|
|
3
|
+
* the pages'. The session store says which organisation it is (workIn()) whenever the user, or the one they work in, changes; a call made with none is an ApiError. The API answers and asks in
|
|
4
|
+
* snake case (`due_date`), the pages' shapes are camel case, so keys are read into one and written out as the other, at every depth. A refusal on a field is about the field as the page names it.
|
|
5
|
+
*/
|
|
6
|
+
import ApiError from "@/api/ApiError";
|
|
7
|
+
import { request } from "@/api/client";
|
|
8
|
+
|
|
9
|
+
let working: number | null = null;
|
|
10
|
+
|
|
11
|
+
// Says which organisation the calls are about, or none.
|
|
12
|
+
export function workIn(id: number | null) {
|
|
13
|
+
working = id;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// What's asked, when a call to an organisation is refused as not found or not allowed, whether the user is still in it: someone
|
|
17
|
+
// removed from it while they have it open is refused everything from then on, and the page, not knowing why, would only say
|
|
18
|
+
// something went wrong. It answers true once it has seen to it — the user read again, told, and sent to where they work now, or to the
|
|
19
|
+
// page for someone in none — and the call then fails as "no longer a member". Set by the frame of the signed-in pages
|
|
20
|
+
// (AppLayout) while it's showing; the function it gives back takes it off.
|
|
21
|
+
type MembershipCheck = (organisation: number) => Promise<boolean>;
|
|
22
|
+
|
|
23
|
+
let checkMembership: MembershipCheck | null = null;
|
|
24
|
+
|
|
25
|
+
export function onRefusal(check: MembershipCheck): () => void {
|
|
26
|
+
checkMembership = check;
|
|
27
|
+
|
|
28
|
+
return () => {
|
|
29
|
+
if(checkMembership === check)
|
|
30
|
+
checkMembership = null;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
// A call to the API for the organisation worked in: `rest` is what follows `/organisations/{id}`; `query`'s empty
|
|
34
|
+
// values are left out. What comes back is read into the pages' names; a 204 gives undefined.
|
|
35
|
+
export async function call<TResult>(method: string, rest: string, body?: unknown, query: Readonly<Record<string, string | number | boolean | null | undefined>> = {}): Promise<TResult> {
|
|
36
|
+
if(working === null)
|
|
37
|
+
throw new ApiError("You're not working in an organisation.");
|
|
38
|
+
|
|
39
|
+
const organisation = working;
|
|
40
|
+
const asked = Object.entries(query).filter(([, value]) => value !== null && value !== undefined && value !== "");
|
|
41
|
+
const search = asked.length ? `?${new URLSearchParams(asked.map(([name, value]) => [name, String(value)])).toString()}` : "";
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
return readNames(await request(method, `/organisations/${organisation}${rest}${search}`, body === undefined ? undefined : writeNames(body))) as TResult;
|
|
45
|
+
} catch(error) {
|
|
46
|
+
if(error instanceof ApiError && error.field !== null)
|
|
47
|
+
throw new ApiError(error.message, camel(error.field), error.status);
|
|
48
|
+
|
|
49
|
+
if(error instanceof ApiError && (error.status == 404 || error.status == 403) && checkMembership && await checkMembership(organisation).catch(() => false))
|
|
50
|
+
throw new ApiError("You're no longer a member of this organisation.", null, 403);
|
|
51
|
+
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Like call(), but a 404 is no one: for what a page may be sent to that's gone.
|
|
57
|
+
export async function callOrNone<TResult>(method: string, rest: string, body?: unknown, query?: Readonly<Record<string, string | number | boolean | null | undefined>>): Promise<TResult | null> {
|
|
58
|
+
try {
|
|
59
|
+
return await call<TResult>(method, rest, body, query);
|
|
60
|
+
} catch(error) {
|
|
61
|
+
if(error instanceof ApiError && error.status == 404)
|
|
62
|
+
return null;
|
|
63
|
+
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// `base_balance` as `baseBalance`, `up_to_30` as `upTo30`.
|
|
69
|
+
export function camel(name: string): string {
|
|
70
|
+
return name.replace(/_([a-z0-9])/g, (_, letter: string) => letter.toUpperCase());
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// `dueDate` as `due_date`, `upTo30` as `up_to_30`; a name with no lower case in it, such as a code, as it is.
|
|
74
|
+
export function snake(name: string): string {
|
|
75
|
+
return /[a-z]/.test(name) ? name.replace(/[A-Z]|(?<=[a-z])\d+/g, found => `_${found.toLowerCase()}`) : name;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// What the API answered, its names read as the pages' own.
|
|
79
|
+
export function readNames(data: unknown): unknown {
|
|
80
|
+
if(Array.isArray(data))
|
|
81
|
+
return data.map(readNames);
|
|
82
|
+
|
|
83
|
+
if(typeof data != "object" || data === null)
|
|
84
|
+
return data;
|
|
85
|
+
|
|
86
|
+
return Object.fromEntries(Object.entries(data).map(([name, value]) => [camel(name), readNames(value)]));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// What a page sends, its names written as the API's own.
|
|
90
|
+
export function writeNames(data: unknown): unknown {
|
|
91
|
+
if(Array.isArray(data))
|
|
92
|
+
return data.map(writeNames);
|
|
93
|
+
|
|
94
|
+
if(typeof data != "object" || data === null)
|
|
95
|
+
return data;
|
|
96
|
+
|
|
97
|
+
return Object.fromEntries(Object.entries(data).map(([name, value]) => [snake(name), writeNames(value)]));
|
|
98
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// What the API's users look like to the app: its UserResource, in the app's own spelling.
|
|
2
|
+
|
|
3
|
+
// A role in an organisation.
|
|
4
|
+
export type Role = "owner" | "admin" | "member";
|
|
5
|
+
|
|
6
|
+
// An organisation the signed-in user belongs to: its name, and their role in it.
|
|
7
|
+
export interface Membership {
|
|
8
|
+
id: number;
|
|
9
|
+
name: string;
|
|
10
|
+
role: Role;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface User {
|
|
14
|
+
id: number;
|
|
15
|
+
name: string;
|
|
16
|
+
email: string;
|
|
17
|
+
verified: boolean;
|
|
18
|
+
// The new email waiting for its link to be opened, if there is one.
|
|
19
|
+
pendingEmail: string | null;
|
|
20
|
+
// The organisation they're working in, if they're in any, and each of theirs.
|
|
21
|
+
organisationId: number | null;
|
|
22
|
+
organisations: readonly Membership[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// What the register form sends: with an invitation's token, the account joins its organisation instead of starting one.
|
|
26
|
+
export interface Registration {
|
|
27
|
+
name: string;
|
|
28
|
+
email: string;
|
|
29
|
+
organisation: string;
|
|
30
|
+
password: string;
|
|
31
|
+
passwordConfirmation: string;
|
|
32
|
+
invitation: string | null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// What the profile's forms send.
|
|
36
|
+
export interface ProfileInput {
|
|
37
|
+
name: string;
|
|
38
|
+
email: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface PasswordInput {
|
|
42
|
+
current: string;
|
|
43
|
+
password: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// What a new organisation is made from, and an organisation's settings.
|
|
47
|
+
export interface NewOrganisation {
|
|
48
|
+
name: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface OrganisationSettings {
|
|
52
|
+
name: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type OrganisationInput = OrganisationSettings;
|
|
56
|
+
|
|
57
|
+
// What the app has told the user.
|
|
58
|
+
export interface AppNotification {
|
|
59
|
+
id: string;
|
|
60
|
+
type: string;
|
|
61
|
+
message: string;
|
|
62
|
+
readAt: string | null;
|
|
63
|
+
createdAt: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface NotificationPage {
|
|
67
|
+
notifications: readonly AppNotification[];
|
|
68
|
+
total: number;
|
|
69
|
+
unread: number;
|
|
70
|
+
page: number;
|
|
71
|
+
pageSize: number;
|
|
72
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* What the organisation pages use beyond the base styles: cards, page heads, tables, tags and the rest. */
|
|
2
|
+
|
|
3
|
+
.notice.locked, .notice.void { border-color: var(--danger); background: var(--danger-soft); }
|
|
4
|
+
.saved { color: var(--muted); font-size: 13px; }
|
|
5
|
+
.card-text { margin: 0 0 14px; font-size: 14px; }
|
|
6
|
+
table.members td { vertical-align: middle; }
|
|
7
|
+
table.tax-rates td.actions { text-align: right; white-space: nowrap; }
|
|
8
|
+
table.members .who small { display: block; color: var(--muted); font-size: 12px; }
|
|
9
|
+
table.members select { width: auto; min-width: 140px; height: 34px; font-size: 14px; }
|
|
10
|
+
td.actions .link-button + .link-button { margin-left: 12px; }
|
|
11
|
+
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
12
|
+
.roles { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
|
|
13
|
+
.roles legend { margin-bottom: 6px; padding: 0; font-size: 14px; font-weight: 600; }
|
|
14
|
+
.invite h1 { margin-top: 16px; }
|
|
15
|
+
td.actions { text-align: right; white-space: nowrap; }
|
|
16
|
+
td.actions .link-button { font-size: 13px; }
|
|
17
|
+
.card > .lead { margin: 0 0 14px; font-size: 14px; max-width: 62ch; }
|
|
18
|
+
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 20px; }
|
|
19
|
+
.page-head h1 { margin: 0; font-size: 22px; line-height: 1.25; }
|
|
20
|
+
.page-head .btn { width: auto; height: 36px; padding: 0 14px; font-size: 14px; white-space: nowrap; }
|
|
21
|
+
.link-button { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
|
|
22
|
+
.card { position: relative; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 3px; background: var(--paper); min-width: 0; }
|
|
23
|
+
.card h2 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
|
|
24
|
+
.skeleton { display: block; border-radius: 3px; background: var(--fill); }
|
|
25
|
+
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
|
|
26
|
+
.card-head h2 { margin: 0; font-size: 15px; color: var(--ink); }
|
|
27
|
+
.card-head .muted { font-size: 13px; }
|
|
28
|
+
.card-head a { font-size: 13px; color: var(--ink); font-weight: 600; text-underline-offset: 2px; }
|
|
29
|
+
.table-wrap { overflow-x: auto; }
|
|
30
|
+
.table-skeleton { height: 180px; }
|
|
31
|
+
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid var(--line); border-radius: 3px; font-size: 11px; font-weight: 600; color: var(--muted); vertical-align: 1px; }
|
|
32
|
+
.empty { padding: 24px 8px; text-align: center; color: var(--muted); }
|
|
33
|
+
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
|
|
34
|
+
.form-foot .btn { width: auto; height: 36px; padding: 0 14px; font-size: 14px; }
|
|
35
|
+
.back { display: inline-block; margin-bottom: 8px; color: var(--ink); font-size: 14px; font-weight: 600; text-underline-offset: 2px; }
|
|
36
|
+
button.back { display: block; width: fit-content; text-align: left; }
|
|
37
|
+
.empty a { color: var(--ink); font-weight: 600; text-underline-offset: 2px; }
|
|
38
|
+
.tag.status { margin-left: 0; }
|
|
39
|
+
.page-head h1 .tag.status { margin-left: 8px; padding: 1px 8px; font-size: 12px; vertical-align: 3px; }
|
|
40
|
+
.tag.status.draft { border-style: dashed; }
|
|
41
|
+
.tag.status.overdue { border-color: var(--danger); color: var(--danger); }
|
|
42
|
+
.tag.status.paid, .tag.status.credited { border-color: var(--ink); color: var(--ink); }
|
|
43
|
+
.tag.status.void { color: var(--muted); text-decoration: line-through; }
|
|
44
|
+
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 14px; }
|
|
45
|
+
.pager-buttons { display: flex; gap: 8px; }
|
|
46
|
+
.pager .btn:disabled { background: none; border-color: var(--line); color: var(--muted); cursor: default; }
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/*
|
|
3
|
+
* The frame of every signed-in page: the top bar (the app's name, the organisation switcher, Members and Settings for those who manage it, the bell, the user's name, Sign out), the email
|
|
4
|
+
* confirmation banner when it applies, then the page itself, shown through a nested <RouterView>: the signed-in pages are this route's children (src/router/routes.ts), so the frame stays while
|
|
5
|
+
* they change. The <RouterView> is keyed by the organisation you're working in, so switching starts every page afresh.
|
|
6
|
+
*
|
|
7
|
+
* Someone removed from the organisation they have open is refused its pages from then on (404, as the API has it for what isn't yours): the first refusal makes it read the user again, and if
|
|
8
|
+
* they're out of it, tell them, and take them to the organisation they work in now, or to the page for someone in none.
|
|
9
|
+
*/
|
|
10
|
+
import { computed, onUnmounted, useRoute, useRouter, watch } from "@mana-js/mana";
|
|
11
|
+
|
|
12
|
+
import { onRefusal } from "@/api/scope";
|
|
13
|
+
import NotificationBell from "@/components/NotificationBell.mana";
|
|
14
|
+
import OrganisationSwitcher from "@/components/OrganisationSwitcher.mana";
|
|
15
|
+
import VerifyBanner from "@/components/VerifyBanner.mana";
|
|
16
|
+
import { useNotificationCount } from "@/composables/notifications";
|
|
17
|
+
import { useNotifications } from "@/stores/notifications";
|
|
18
|
+
import { useSession } from "@/stores/session";
|
|
19
|
+
import { useToasts } from "@/stores/toasts";
|
|
20
|
+
|
|
21
|
+
const route = useRoute();
|
|
22
|
+
const router = useRouter();
|
|
23
|
+
const sessionStore = useSession();
|
|
24
|
+
const notificationsStore = useNotifications();
|
|
25
|
+
const toastStore = useToasts();
|
|
26
|
+
// One check at a time, whatever number of calls the page made are refused together.
|
|
27
|
+
let checking: Promise<boolean> | null = null;
|
|
28
|
+
|
|
29
|
+
// Whether the user is out of an organisation, seen to: read again; if signed out, to sign in; if out of it, told, and taken to where they work now, or to the page for someone in none.
|
|
30
|
+
async function removedFrom(organisation: number): Promise<boolean> {
|
|
31
|
+
const name = sessionStore.organisation?.name ?? "that organisation";
|
|
32
|
+
|
|
33
|
+
await sessionStore.load();
|
|
34
|
+
|
|
35
|
+
if(!sessionStore.signedIn) {
|
|
36
|
+
await router.push({ name: "login" });
|
|
37
|
+
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if(sessionStore.user?.organisations.some(one => one.id == organisation))
|
|
42
|
+
return false;
|
|
43
|
+
|
|
44
|
+
const now = sessionStore.organisation;
|
|
45
|
+
|
|
46
|
+
// Told once they're there: a page's toasts go with it.
|
|
47
|
+
await router.push(now ? { name: "dashboard" } : { name: "organisations.none" });
|
|
48
|
+
toastStore.error(`You're no longer in ${name}`, now ? `You're working in ${now.name} now.` : "You're not in an organisation.");
|
|
49
|
+
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const stopWatching = onRefusal(organisation => checking ??= removedFrom(organisation).finally(() => checking = null));
|
|
54
|
+
const key = computed(() => sessionStore.organisation?.id ?? 0);
|
|
55
|
+
|
|
56
|
+
// Navigating asks again how many notifications are unread.
|
|
57
|
+
watch(() => route.path, () => void notificationsStore.refresh());
|
|
58
|
+
|
|
59
|
+
// And so does a minute going by, or the tab coming back to the front: what's told to the user while they work shows soon enough.
|
|
60
|
+
useNotificationCount();
|
|
61
|
+
|
|
62
|
+
onUnmounted(() => stopWatching());
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<template>
|
|
66
|
+
<header class="topbar">
|
|
67
|
+
<RouterLink to="/" class="brand">Mana Starter</RouterLink>
|
|
68
|
+
<OrganisationSwitcher />
|
|
69
|
+
<nav class="nav" aria-label="Organisation" m-if="sessionStore.manages">
|
|
70
|
+
<RouterLink :to="{ name: 'members' }">Members</RouterLink>
|
|
71
|
+
<RouterLink :to="{ name: 'settings' }">Settings</RouterLink>
|
|
72
|
+
</nav>
|
|
73
|
+
<div class="spacer"></div>
|
|
74
|
+
<NotificationBell />
|
|
75
|
+
<RouterLink to="/profile" class="user">{{ sessionStore.user?.name }}</RouterLink>
|
|
76
|
+
<button type="button" class="btn small" @click="sessionStore.signOut()">Sign out</button>
|
|
77
|
+
</header>
|
|
78
|
+
|
|
79
|
+
<VerifyBanner />
|
|
80
|
+
|
|
81
|
+
<RouterView :key="key" />
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<style scoped>
|
|
85
|
+
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 20px; background: var(--paper); border-bottom: 1.5px solid var(--line); }
|
|
86
|
+
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
|
|
87
|
+
.nav { display: flex; gap: 14px; }
|
|
88
|
+
.nav a, .user { color: var(--ink); text-decoration: none; }
|
|
89
|
+
.nav a:hover, .user:hover { text-decoration: underline; }
|
|
90
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/*
|
|
3
|
+
* The bell in the top bar: a link to the notifications page, with how many are unread. Its name says it
|
|
4
|
+
* — "Notifications, 3 unread" — for a screen reader, since the badge is only a number. The count is the notifications store's,
|
|
5
|
+
* which the frame keeps current. With a `target` — a `#section` on the page — it's a link to that instead, for the page for someone in no
|
|
6
|
+
* organisation, where the notifications are a section of the page and not a page of their own.
|
|
7
|
+
*/
|
|
8
|
+
import { computed } from "@mana-js/mana";
|
|
9
|
+
|
|
10
|
+
import { useNotifications } from "@/stores/notifications";
|
|
11
|
+
|
|
12
|
+
defineOptions({ name: "NotificationBell" });
|
|
13
|
+
|
|
14
|
+
defineProps<{ target?: string }>();
|
|
15
|
+
|
|
16
|
+
const notificationsStore = useNotifications();
|
|
17
|
+
const unread = computed(() => notificationsStore.unread);
|
|
18
|
+
const label = computed(() => unread.value ? `Notifications, ${unread.value} unread` : "Notifications");
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<a class="bell btn small" :href="target" :aria-label="label" m-if="target">
|
|
23
|
+
<span aria-hidden="true">🔔</span>
|
|
24
|
+
<span class="badge" aria-hidden="true" m-if="unread">{{ unread > 99 ? "99+" : unread }}</span>
|
|
25
|
+
</a>
|
|
26
|
+
<RouterLink class="bell btn small" :to="{ name: 'notifications' }" :aria-label="label" m-else>
|
|
27
|
+
<span aria-hidden="true">🔔</span>
|
|
28
|
+
<span class="badge" aria-hidden="true" m-if="unread">{{ unread > 99 ? "99+" : unread }}</span>
|
|
29
|
+
</RouterLink>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<style scoped>
|
|
33
|
+
.bell { position: relative; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
|
|
34
|
+
.badge { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; }
|
|
35
|
+
</style>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/*
|
|
3
|
+
* The user's notifications as a list, newest first, 25 to a page: an unread one is marked, and has Mark as read; every one has Delete;
|
|
4
|
+
* Mark all as read when there's any unread. What it says is its `message`. It's the body of the notifications page, and a section of the page
|
|
5
|
+
* for someone in no organisation. The page it shows is the parent's to say (`page`) and to change (`turn`), so one can keep it in the URL
|
|
6
|
+
* and the other needn't. Reading and deleting change the bell's count as soon as they're done.
|
|
7
|
+
*/
|
|
8
|
+
import { computed, resource, watch } from "@mana-js/mana";
|
|
9
|
+
|
|
10
|
+
import ApiError from "@/api/ApiError";
|
|
11
|
+
import * as api from "@/api/notifications";
|
|
12
|
+
import { useNotifications } from "@/stores/notifications";
|
|
13
|
+
import { useToasts } from "@/stores/toasts";
|
|
14
|
+
import { fullDate } from "@/utilities/format";
|
|
15
|
+
|
|
16
|
+
defineOptions({ name: "NotificationList" });
|
|
17
|
+
const props = defineProps<{ page: number }>();
|
|
18
|
+
const emit = defineEmits<{ turn: [page: number] }>();
|
|
19
|
+
|
|
20
|
+
const notificationsStore = useNotifications();
|
|
21
|
+
const toastStore = useToasts();
|
|
22
|
+
|
|
23
|
+
const list = resource(async () => {
|
|
24
|
+
const loaded = await api.notifications({ page: props.page, perPage: 25 });
|
|
25
|
+
|
|
26
|
+
notificationsStore.set(loaded.unread, loaded.total);
|
|
27
|
+
|
|
28
|
+
return loaded;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// One pushed while the list shows is on it at once.
|
|
32
|
+
watch(() => notificationsStore.arrived, () => list.reload());
|
|
33
|
+
|
|
34
|
+
const pages = computed(() => list.data ? Math.max(1, Math.ceil(list.data.total / list.data.pageSize)) : 1);
|
|
35
|
+
const range = computed(() => {
|
|
36
|
+
const data = list.data;
|
|
37
|
+
|
|
38
|
+
if(!data || !data.total)
|
|
39
|
+
return "";
|
|
40
|
+
|
|
41
|
+
const first = (data.page - 1) * data.pageSize + 1;
|
|
42
|
+
|
|
43
|
+
return `${first}–${Math.min(data.page * data.pageSize, data.total)} of ${data.total}`;
|
|
44
|
+
});
|
|
45
|
+
const rows = computed(() => (list.data?.notifications ?? []).map(notification => ({ ...notification, when: fullDate(notification.createdAt.slice(0, 10)), unread: notification.readAt === null })));
|
|
46
|
+
|
|
47
|
+
// Does something to the notifications, then reads them again; a refusal is a toast.
|
|
48
|
+
async function act(change: () => Promise<void>) {
|
|
49
|
+
try {
|
|
50
|
+
await change();
|
|
51
|
+
} catch(error) {
|
|
52
|
+
toastStore.error("That didn't work", error instanceof ApiError ? error.message : "Something went wrong. Try again.");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
list.reload();
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<div class="alert" role="alert" m-if="list.error">
|
|
61
|
+
We couldn't load your notifications.
|
|
62
|
+
<button type="button" class="link-button" @click="list.reload()">Try again</button>.
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div class="card" m-else-if="list.data">
|
|
66
|
+
<div class="all" m-if="list.data.unread">
|
|
67
|
+
<button type="button" class="btn small" @click="act(() => api.markAllRead())">Mark all as read</button>
|
|
68
|
+
</div>
|
|
69
|
+
<p class="empty" m-if="!list.data.total">Nothing yet. What the app tells you shows here.</p>
|
|
70
|
+
<ul class="notices" m-else>
|
|
71
|
+
<li m-for="notification in rows" :key="notification.id" :class="{ unread: notification.unread }">
|
|
72
|
+
<div class="said">
|
|
73
|
+
<span class="dot" aria-hidden="true" m-if="notification.unread"></span>
|
|
74
|
+
<div class="text">
|
|
75
|
+
<p>{{ notification.message }}</p>
|
|
76
|
+
<p class="muted when">{{ notification.when }}<span class="sr-only" m-if="notification.unread"> · unread</span></p>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="acts">
|
|
80
|
+
<button type="button" class="link-button" m-if="notification.unread" :aria-label="'Mark as read: ' + notification.message" @click="act(() => api.markRead(notification.id))">Mark as read</button>
|
|
81
|
+
<button type="button" class="link-button" :aria-label="'Delete: ' + notification.message" @click="act(() => api.remove(notification.id))">Delete</button>
|
|
82
|
+
</div>
|
|
83
|
+
</li>
|
|
84
|
+
</ul>
|
|
85
|
+
<div class="pager" m-if="list.data.total > list.data.pageSize">
|
|
86
|
+
<span class="muted">{{ range }}</span>
|
|
87
|
+
<div class="pager-buttons">
|
|
88
|
+
<button type="button" class="btn small" :disabled="list.data.page <= 1" @click="emit('turn', list.data.page - 1)">‹ Previous</button>
|
|
89
|
+
<button type="button" class="btn small" :disabled="list.data.page >= pages" @click="emit('turn', list.data.page + 1)">Next ›</button>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div class="card" aria-busy="true" aria-label="Loading your notifications" m-else>
|
|
95
|
+
<span class="skeleton table-skeleton"></span>
|
|
96
|
+
</div>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<style scoped>
|
|
100
|
+
.all { display: flex; justify-content: flex-end; margin-bottom: 4px; }
|
|
101
|
+
.notices { margin: 0; padding: 0; list-style: none; }
|
|
102
|
+
.notices li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
|
|
103
|
+
.notices li:last-child { border-bottom: 0; }
|
|
104
|
+
.said { display: flex; align-items: flex-start; gap: 10px; min-width: 0; flex: 1 1 14rem; }
|
|
105
|
+
.said .text { min-width: 0; }
|
|
106
|
+
.said p { margin: 0; }
|
|
107
|
+
.notices li.unread .text p:first-child { font-weight: 700; }
|
|
108
|
+
.dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--ink); }
|
|
109
|
+
.when { font-size: 13px; }
|
|
110
|
+
.acts { display: flex; gap: 14px; flex: none; }
|
|
111
|
+
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
112
|
+
</style>
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/*
|
|
3
|
+
* The organisation you're working in, in the top bar: its name opens a
|
|
4
|
+
* menu of your organisations, with your role in each, then New
|
|
5
|
+
* organisation. Choosing another opens its dashboard; AppLayout keys its pages
|
|
6
|
+
* by organisation, so nothing of the last one stays. The dashboard is
|
|
7
|
+
* reached first, so a page with unsaved changes can ask before anything goes
|
|
8
|
+
*.
|
|
9
|
+
*
|
|
10
|
+
* It follows the ARIA menu button pattern: the button says it has a menu and
|
|
11
|
+
* whether it's open; opening it (a click, Enter, Space or the arrow keys)
|
|
12
|
+
* focuses the current organisation (or the last item, for the up arrow); the
|
|
13
|
+
* arrow keys move between the items, Home and End go to the first and last,
|
|
14
|
+
* Escape closes it and returns to the button, and Tab or a click elsewhere
|
|
15
|
+
* closes it.
|
|
16
|
+
*/
|
|
17
|
+
import { onUnmounted, ref, useRoute, useRouter, useTemplateRef, watch } from "@mana-js/mana";
|
|
18
|
+
|
|
19
|
+
import ApiError from "@/api/ApiError";
|
|
20
|
+
import { ROLES } from "@/shared/roles";
|
|
21
|
+
import { useSession } from "@/stores/session";
|
|
22
|
+
import { useToasts } from "@/stores/toasts";
|
|
23
|
+
|
|
24
|
+
defineOptions({ name: "OrganisationSwitcher" });
|
|
25
|
+
|
|
26
|
+
const route = useRoute();
|
|
27
|
+
const router = useRouter();
|
|
28
|
+
const sessionStore = useSession();
|
|
29
|
+
const toastStore = useToasts();
|
|
30
|
+
const root = useTemplateRef("root", HTMLElement);
|
|
31
|
+
const button = useTemplateRef("button", HTMLElement);
|
|
32
|
+
const menu = useTemplateRef("menu", HTMLElement);
|
|
33
|
+
|
|
34
|
+
const open = ref(false);
|
|
35
|
+
const switching = ref(false);
|
|
36
|
+
// The item to focus once the menu is on the page: the current organisation's, or one at an index.
|
|
37
|
+
let wanted: number | null = null;
|
|
38
|
+
|
|
39
|
+
function items() {
|
|
40
|
+
return [...menu.value?.querySelectorAll("button") ?? []];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// A click outside the switcher closes it.
|
|
44
|
+
function outside(event: PointerEvent) {
|
|
45
|
+
if(event.target instanceof Node && !root.value?.contains(event.target))
|
|
46
|
+
close(false);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Opens the menu, to focus the current organisation, or the item at `index`, once it's on the page
|
|
50
|
+
// (after the handler that opened it, R5).
|
|
51
|
+
function show(index: number | null = null) {
|
|
52
|
+
wanted = index;
|
|
53
|
+
open.value = true;
|
|
54
|
+
document.addEventListener("pointerdown", outside);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
watch(menu, element => {
|
|
58
|
+
if(!element)
|
|
59
|
+
return;
|
|
60
|
+
|
|
61
|
+
const all = items();
|
|
62
|
+
const current = all.findIndex(item => item.getAttribute("aria-checked") == "true");
|
|
63
|
+
|
|
64
|
+
all.at(wanted ?? Math.max(current, 0))?.focus();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
function close(refocus: boolean) {
|
|
68
|
+
open.value = false;
|
|
69
|
+
document.removeEventListener("pointerdown", outside);
|
|
70
|
+
|
|
71
|
+
if(refocus)
|
|
72
|
+
button.value?.focus();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function toggle() {
|
|
76
|
+
if(open.value)
|
|
77
|
+
close(true);
|
|
78
|
+
else
|
|
79
|
+
show();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// The keys inside the open menu.
|
|
83
|
+
function move(event: KeyboardEvent) {
|
|
84
|
+
const all = items();
|
|
85
|
+
const index = all.findIndex(item => item == document.activeElement);
|
|
86
|
+
const target = {
|
|
87
|
+
ArrowDown: (index + 1) % all.length,
|
|
88
|
+
ArrowUp: (index - 1 + all.length) % all.length,
|
|
89
|
+
Home: 0,
|
|
90
|
+
End: all.length - 1,
|
|
91
|
+
}[event.key];
|
|
92
|
+
|
|
93
|
+
if(target !== undefined) {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
all[target]?.focus();
|
|
96
|
+
} else if(event.key == "Escape") {
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
close(true);
|
|
99
|
+
} else if(event.key == "Tab") {
|
|
100
|
+
close(false);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Opens the organisation's dashboard: the dashboard first, so a page with unsaved changes can ask, then
|
|
105
|
+
// the switch, which starts the pages afresh.
|
|
106
|
+
async function choose(id: number) {
|
|
107
|
+
close(true);
|
|
108
|
+
|
|
109
|
+
if(id == sessionStore.organisation?.id || switching.value)
|
|
110
|
+
return;
|
|
111
|
+
|
|
112
|
+
if(route.name != "dashboard" && !await router.push({ name: "dashboard" }))
|
|
113
|
+
return;
|
|
114
|
+
|
|
115
|
+
switching.value = true;
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
await sessionStore.switchOrganisation(id);
|
|
119
|
+
} catch(error) {
|
|
120
|
+
toastStore.error("Couldn't switch organisation", error instanceof ApiError ? error.message : "Something went wrong. Try again.");
|
|
121
|
+
} finally {
|
|
122
|
+
switching.value = false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function create() {
|
|
127
|
+
close(false);
|
|
128
|
+
void router.push({ name: "organisations.create" });
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
onUnmounted(() => document.removeEventListener("pointerdown", outside));
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<template>
|
|
135
|
+
<div class="switcher" ref="root">
|
|
136
|
+
<button type="button" class="switcher-button" ref="button" aria-haspopup="menu" aria-controls="switcher-menu" :aria-expanded="open ? 'true' : 'false'" :aria-busy="switching ? 'true' : 'false'" @click="toggle()" @keydown.down.prevent="show()" @keydown.up.prevent="show(-1)">
|
|
137
|
+
<span>{{ sessionStore.organisation?.name }}</span>
|
|
138
|
+
<span class="caret" aria-hidden="true">▾</span>
|
|
139
|
+
</button>
|
|
140
|
+
<ul class="switcher-menu" id="switcher-menu" role="menu" aria-label="Your organisations" ref="menu" m-if="open" @keydown="move">
|
|
141
|
+
<li role="none" m-for="organisation in sessionStore.user?.organisations ?? []" :key="organisation.id">
|
|
142
|
+
<button type="button" role="menuitemradio" tabindex="-1" :aria-checked="organisation.id == sessionStore.organisation?.id ? 'true' : 'false'" @click="choose(organisation.id)">
|
|
143
|
+
<span>{{ organisation.name }}</span>
|
|
144
|
+
<span class="role">{{ ROLES[organisation.role].label }}</span>
|
|
145
|
+
</button>
|
|
146
|
+
</li>
|
|
147
|
+
<li class="sep" role="separator"></li>
|
|
148
|
+
<li role="none">
|
|
149
|
+
<button type="button" role="menuitem" tabindex="-1" @click="create()">New organisation</button>
|
|
150
|
+
</li>
|
|
151
|
+
</ul>
|
|
152
|
+
</div>
|
|
153
|
+
</template>
|
|
154
|
+
|
|
155
|
+
<style scoped>
|
|
156
|
+
.switcher { position: relative; }
|
|
157
|
+
.switcher-button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 3px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
|
|
158
|
+
.switcher-button[aria-busy="true"] { opacity: .6; }
|
|
159
|
+
.switcher-button .caret { font-size: 11px; color: var(--muted); }
|
|
160
|
+
.switcher-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 6; width: 300px; margin: 0; padding: 6px; list-style: none; border: 1.5px solid var(--ink); border-radius: 3px; background: var(--paper); box-shadow: 0 8px 0 rgba(28, 33, 40, .12); }
|
|
161
|
+
.switcher-menu button { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 3px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
|
|
162
|
+
.switcher-menu button:hover, .switcher-menu button:focus-visible { background: var(--line-soft); }
|
|
163
|
+
.switcher-menu button[aria-checked="true"] { background: var(--fill); font-weight: 700; }
|
|
164
|
+
.switcher-menu .role { font-size: 12px; font-weight: 400; color: var(--muted); }
|
|
165
|
+
.switcher-menu .sep { height: 1px; margin: 6px 4px; background: var(--line-soft); }
|
|
166
|
+
|
|
167
|
+
/* On a phone, the menu stays inside the window. */
|
|
168
|
+
@media (max-width: 640px) {
|
|
169
|
+
.switcher-menu { width: min(300px, calc(100vw - 32px)); }
|
|
170
|
+
}
|
|
171
|
+
</style>
|