@webx-ui/module-reviews 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 +76 -0
- package/dist/ReviewPane.d.ts +24 -0
- package/dist/ReviewsPage.d.ts +22 -0
- package/dist/api.d.ts +26 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +682 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +7 -0
- package/dist/module.d.ts +21 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +62 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 webx-ui
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @webx-ui/module-reviews
|
|
2
|
+
|
|
3
|
+
The front end of the reviews section of the [WebX UI](https://github.com/webx-ui/webx-ui) admin
|
|
4
|
+
panel: reviews — a photo, a name, a job title, the stars and a text — and the categories they are
|
|
5
|
+
filed under.
|
|
6
|
+
|
|
7
|
+
The other half is the Composer package `webx-ui/module-reviews`, which owns the reviews, their
|
|
8
|
+
order, the Reviews block, `reviews()` for templates and the API. A section appears in the panel
|
|
9
|
+
when both halves are installed.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @webx-ui/module-reviews
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createAdmin } from '@webx-ui/module-admin'
|
|
19
|
+
import { reviews } from '@webx-ui/module-reviews'
|
|
20
|
+
import '@webx-ui/module-reviews/style.css'
|
|
21
|
+
|
|
22
|
+
createAdmin({
|
|
23
|
+
basePath: '/cms',
|
|
24
|
+
modules: [...reviews()],
|
|
25
|
+
}).mount()
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`reviews()` answers with two sections — the reviews and their categories — because the panel draws
|
|
29
|
+
one entry per module. The server puts both in the `reviews` group. `reviews({ path: '/testimonials' })`
|
|
30
|
+
puts them somewhere else inside the panel.
|
|
31
|
+
|
|
32
|
+
On the server, the block type the module offers is installed once:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
php artisan webx:blocks:offered --install --module=reviews
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Reviews
|
|
39
|
+
|
|
40
|
+
A list and the form of one review side by side, without pages: the list is where reviews are put
|
|
41
|
+
in order, and a drag cannot cross a page boundary. The open review is in the address
|
|
42
|
+
(`?review=12`), so a link to it is a link to the list around it too. **New review** is a row that
|
|
43
|
+
opens an empty form; the review is created by its first save. On a phone the form slides over the
|
|
44
|
+
list and draws its own «Back».
|
|
45
|
+
|
|
46
|
+
A row shows the photo (or the initials), the name, the stars and the languages a reader sees the
|
|
47
|
+
review in; a published review whose text is written in no language is marked — it is seen nowhere.
|
|
48
|
+
|
|
49
|
+
The list has two orders, and the filter decides which one you are dragging:
|
|
50
|
+
|
|
51
|
+
- **no category chosen** — the order of the whole list;
|
|
52
|
+
- **a category chosen** — the order inside that category only. Every other category keeps its own.
|
|
53
|
+
|
|
54
|
+
While a search narrows the list, the grips disappear.
|
|
55
|
+
|
|
56
|
+
The form is the `reviews.form` screen, described in JSON on the server: the photo from the library,
|
|
57
|
+
the name, the job title and the text in every language of the site, the stars, the date, a link to
|
|
58
|
+
the person's profile, the categories, **Published** and a card for the project's own fields. Save
|
|
59
|
+
with the button or `Ctrl+S`; leaving with unsaved changes asks first. A review has no draft: a save
|
|
60
|
+
is on the site.
|
|
61
|
+
|
|
62
|
+
## Categories
|
|
63
|
+
|
|
64
|
+
The panel's shared category screens with this module's words (`reviewCategoriesOptions()`),
|
|
65
|
+
without addresses: a category is a button in a block's filter and a way to pick reviews for a
|
|
66
|
+
block.
|
|
67
|
+
|
|
68
|
+
## On the site
|
|
69
|
+
|
|
70
|
+
The module has no page of its own. Reviews reach the site in the **Reviews** block — one, a grid, a
|
|
71
|
+
slider or a marquee — or through `reviews()` in a template of the site. See the
|
|
72
|
+
[guide](https://webx-ui.github.io/webx-ui/guide/reviews.html).
|
|
73
|
+
|
|
74
|
+
## Licence
|
|
75
|
+
|
|
76
|
+
MIT
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReviewSummary } from './types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** `null` — a review not written yet. */
|
|
4
|
+
id: number | null;
|
|
5
|
+
/** The category the list is narrowed to: a new review starts in it. */
|
|
6
|
+
category?: number | null;
|
|
7
|
+
/** False in the drawer a narrow screen opens this in. */
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
11
|
+
saved: (review: ReviewSummary) => any;
|
|
12
|
+
back: () => any;
|
|
13
|
+
created: (review: ReviewSummary) => any;
|
|
14
|
+
removed: (id: number) => any;
|
|
15
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
16
|
+
onSaved?: ((review: ReviewSummary) => any) | undefined;
|
|
17
|
+
onBack?: (() => any) | undefined;
|
|
18
|
+
onCreated?: ((review: ReviewSummary) => any) | undefined;
|
|
19
|
+
onRemoved?: ((id: number) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
category: number | null;
|
|
22
|
+
inline: boolean;
|
|
23
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reviews: all of them on the left, the one being written on the right (§4.6, decision 11).
|
|
3
|
+
*
|
|
4
|
+
* The same shape as the FAQ, for the same reason: a review is typed in from a message in a
|
|
5
|
+
* minute, and the next one is usually the one under it — a round trip through a page of its own
|
|
6
|
+
* for every review is most of the time spent. On a phone the form is the whole screen, in the
|
|
7
|
+
* drawer `WxListDetail` raises, and draws its own way back.
|
|
8
|
+
*
|
|
9
|
+
* The order is decision 6: without a filter a drag moves the common order; narrowed to one
|
|
10
|
+
* category, the category's own; a search or the bin shows a selection, so the grips go away and
|
|
11
|
+
* the line under the list says why.
|
|
12
|
+
*
|
|
13
|
+
* Everything the screen is looking at lives in the address — the view, the category, the search
|
|
14
|
+
* and the open review — so a link to a review is a link to it in its list.
|
|
15
|
+
*/
|
|
16
|
+
type __VLS_Props = {
|
|
17
|
+
base?: string;
|
|
18
|
+
};
|
|
19
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
20
|
+
base: string;
|
|
21
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
22
|
+
export default _default;
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AdminContext } from '@webx-ui/module-admin';
|
|
2
|
+
import { ScreenModel } from '@webx-ui/schema';
|
|
3
|
+
import { ReviewDetail, ReviewQuery, ReviewRow, ReviewsList } from './types';
|
|
4
|
+
export interface ReviewsApi {
|
|
5
|
+
/** Every review, with the categories the list can be narrowed to. */
|
|
6
|
+
list(query?: ReviewQuery): Promise<ReviewsList>;
|
|
7
|
+
get(id: number): Promise<ReviewDetail>;
|
|
8
|
+
/**
|
|
9
|
+
* A new review out of the values of its form, in one request: the form is filled in first and
|
|
10
|
+
* the record made on the first save, so nobody leaves an empty review behind.
|
|
11
|
+
*/
|
|
12
|
+
create(values: ScreenModel): Promise<ReviewDetail>;
|
|
13
|
+
/** Refused with a 422 under the name of the field. */
|
|
14
|
+
save(id: number, values: ScreenModel): Promise<ReviewDetail>;
|
|
15
|
+
remove(id: number): Promise<void>;
|
|
16
|
+
restore(id: number): Promise<ReviewRow>;
|
|
17
|
+
/** The order on screen: of the whole list, or — with `category` — of that category alone. */
|
|
18
|
+
reorder(ids: number[], category?: number | null): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/** The path of the list under the panel's API, and of its order (`CategoryRoutes::items()`). */
|
|
21
|
+
export declare const REVIEWS_API = "reviews";
|
|
22
|
+
/**
|
|
23
|
+
* Everything under `/reviews`, below the panel's API path — except the categories, which are the
|
|
24
|
+
* panel's shared ones and are asked for with `createCategoriesApi(admin, 'reviews/categories')`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createReviewsApi(admin: AdminContext): ReviewsApi;
|
package/dist/i18n.d.ts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { reviews, reviewCategoriesOptions, type ReviewsOptions } from './module';
|
|
2
|
+
export { createReviewsApi, REVIEWS_API, type ReviewsApi } from './api';
|
|
3
|
+
export { reviewsMessages } from './messages';
|
|
4
|
+
export { default as WxReviewsPage } from './ReviewsPage';
|
|
5
|
+
export { default as WxReviewPane } from './ReviewPane';
|
|
6
|
+
export type { ReviewCategoryRef, ReviewDetail, ReviewQuery, ReviewRow, ReviewsList, ReviewSummary, } from './types';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,682 @@
|
|
|
1
|
+
import { reorderItems as ge, useAdmin as Z, useTranslate as oe, useErrorText as se, WxScreenHead as fe, WxScreen as me, WxSaveState as be, useItemOrder as xe, WxListScreen as _e, WxRowMenu as ke, categoryRoutes as Se } from "@webx-ui/module-admin";
|
|
2
|
+
import { defineComponent as le, ref as W, computed as y, onMounted as We, onBeforeUnmount as ne, openBlock as u, createElementBlock as $, createBlock as x, unref as t, Fragment as Q, createVNode as f, createSlots as Te, withCtx as p, createTextVNode as M, toDisplayString as S, createCommentVNode as N, watch as te, createElementVNode as D, normalizeClass as G, resolveDynamicComponent as Re, renderList as Ne } from "vue";
|
|
3
|
+
import { onBeforeRouteUpdate as qe, onBeforeRouteLeave as $e, useRoute as Ce, useRouter as Be } from "vue-router";
|
|
4
|
+
import { useLocales as Ve, localizedValue as Le, WxSkeleton as ve, WxBadge as F, WxActionBar as Pe, WxButton as Ae, toast as _, confirm as X, WxCard as ze, WxListDetail as Ie, WxEmpty as ae, WxInput as Me, WxIcon as re, WxSelect as Ue, WxSortableList as De, WxAvatar as Oe, WxTooltip as je, WxAlert as Ee } from "@webx-ui/core";
|
|
5
|
+
const Y = "reviews";
|
|
6
|
+
function ce(n) {
|
|
7
|
+
const v = `${n.apiPath}/${Y}`, s = (a) => a.data;
|
|
8
|
+
return {
|
|
9
|
+
list: (a = {}) => {
|
|
10
|
+
const c = new URLSearchParams();
|
|
11
|
+
return a.search && c.set("search", a.search), a.category != null && c.set("category", String(a.category)), a.trashed && c.set("trashed", "1"), n.http.get(c.size > 0 ? `${v}?${c}` : v);
|
|
12
|
+
},
|
|
13
|
+
get: (a) => n.http.get(`${v}/${a}`).then(s),
|
|
14
|
+
create: (a) => n.http.post(v, { values: a }).then(s),
|
|
15
|
+
save: (a, c) => n.http.put(`${v}/${a}`, { values: c }).then(s),
|
|
16
|
+
remove: (a) => n.http.delete(`${v}/${a}`).then(() => {
|
|
17
|
+
}),
|
|
18
|
+
// The resource of the list line, and not the form's pair: a restored review stays closed.
|
|
19
|
+
restore: (a) => n.http.post(`${v}/${a}/restore`, {}).then(s),
|
|
20
|
+
reorder: (a, c = null) => ge(n, Y, a, c)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const Je = {
|
|
24
|
+
module: {
|
|
25
|
+
group: "Reviews",
|
|
26
|
+
reviews: "Reviews",
|
|
27
|
+
categories: "Categories"
|
|
28
|
+
},
|
|
29
|
+
review: {
|
|
30
|
+
new: "New review",
|
|
31
|
+
untitled: "Untitled",
|
|
32
|
+
search: "Search the reviews",
|
|
33
|
+
empty: "No reviews yet.",
|
|
34
|
+
"empty-help": "A review reaches the site in a reviews block, on any page.",
|
|
35
|
+
"empty-search": "Nothing matches that.",
|
|
36
|
+
"empty-bin": "The bin is empty.",
|
|
37
|
+
all: "All",
|
|
38
|
+
trashed: "Bin",
|
|
39
|
+
"filter-category": "Category",
|
|
40
|
+
"any-category": "Any category",
|
|
41
|
+
"not-published": "Not published",
|
|
42
|
+
"visible-nowhere": "Published, but seen in no language: it needs a text in one.",
|
|
43
|
+
"no-text": "No text yet",
|
|
44
|
+
"no-rating": "No rating",
|
|
45
|
+
"seen-in": "Seen in: :locales",
|
|
46
|
+
choose: "Choose a review",
|
|
47
|
+
"choose-help": "Or write a new one: the first line of the list.",
|
|
48
|
+
save: "Save",
|
|
49
|
+
saved: "The review is saved.",
|
|
50
|
+
"save-failed": "The review was not saved.",
|
|
51
|
+
cancel: "Cancel",
|
|
52
|
+
delete: "Delete",
|
|
53
|
+
"delete-title": "Delete the review by “:name”?",
|
|
54
|
+
"delete-text": "It goes to the bin and leaves every block on the site. Restored, it comes back to its places.",
|
|
55
|
+
deleted: "The review is in the bin.",
|
|
56
|
+
restore: "Restore",
|
|
57
|
+
restored: "The review is back.",
|
|
58
|
+
"reorder-failed": "The new order was not saved.",
|
|
59
|
+
"leave-title": "Leave without saving?",
|
|
60
|
+
"leave-text": "What you wrote in this review is not on the server.",
|
|
61
|
+
leave: "Leave",
|
|
62
|
+
back: "Back to the list"
|
|
63
|
+
},
|
|
64
|
+
screen: {
|
|
65
|
+
author: "Who wrote it",
|
|
66
|
+
photo: "Photo",
|
|
67
|
+
"photo-help": "Without one, the site shows the initials of the name.",
|
|
68
|
+
name: "Name",
|
|
69
|
+
"name-help": "Not written in a language, it is shown as written in the default one.",
|
|
70
|
+
"job-title": "Job title",
|
|
71
|
+
"job-title-help": "Or the company, or the city: whatever is printed under the name.",
|
|
72
|
+
"profile-url": "Link to a profile",
|
|
73
|
+
"profile-url-help": "An address starting with http:// or https://. The name becomes a link to it.",
|
|
74
|
+
review: "Review",
|
|
75
|
+
text: "Text",
|
|
76
|
+
"text-help": "A review is shown in a language only when it has a text in it.",
|
|
77
|
+
rating: "Rating",
|
|
78
|
+
"rating-help": "From one star to five. No stars, no rating shown.",
|
|
79
|
+
"reviewed-on": "Date",
|
|
80
|
+
"reviewed-on-help": "Shown if the block prints it; it changes neither the order nor who sees the review.",
|
|
81
|
+
settings: "Settings",
|
|
82
|
+
published: "Published",
|
|
83
|
+
"published-help": "On the site in every block that shows its categories, from the moment it is saved.",
|
|
84
|
+
categories: "Categories",
|
|
85
|
+
"categories-help": "What a block picks the review by, and the buttons of its filter."
|
|
86
|
+
},
|
|
87
|
+
category: {
|
|
88
|
+
"field-title": "Title",
|
|
89
|
+
visible: "Shown on the site",
|
|
90
|
+
"visible-help": "Hidden, it drops out of every filter; its reviews stay in the blocks that show them.",
|
|
91
|
+
new: "New category",
|
|
92
|
+
empty: "No categories yet.",
|
|
93
|
+
"empty-help": "A category groups reviews: a block shows the ones you pick, and its filter has a button for each.",
|
|
94
|
+
order: "Drag to change the order of the filter buttons on the site.",
|
|
95
|
+
hidden: "Hidden from the site",
|
|
96
|
+
reviews: "Reviews: :count",
|
|
97
|
+
"show-reviews": "Show its reviews",
|
|
98
|
+
"delete-blocked": "This category still holds reviews. Move them first.",
|
|
99
|
+
"delete-text": "It goes to the bin and its button leaves every filter. Its reviews stay.",
|
|
100
|
+
deleted: "The category is in the bin.",
|
|
101
|
+
saved: "The category is saved."
|
|
102
|
+
}
|
|
103
|
+
}, ie = /* @__PURE__ */ new WeakSet();
|
|
104
|
+
function ue() {
|
|
105
|
+
try {
|
|
106
|
+
const { i18n: n } = Z();
|
|
107
|
+
ie.has(n) || (n.defaults("webx-reviews", Je), ie.add(n));
|
|
108
|
+
} catch {
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const Fe = /* @__PURE__ */ le({
|
|
112
|
+
name: "WxReviewPane",
|
|
113
|
+
__name: "ReviewPane",
|
|
114
|
+
props: {
|
|
115
|
+
id: {},
|
|
116
|
+
category: { default: null },
|
|
117
|
+
inline: { type: Boolean, default: !0 }
|
|
118
|
+
},
|
|
119
|
+
emits: ["back", "saved", "created", "removed"],
|
|
120
|
+
setup(n, { emit: v }) {
|
|
121
|
+
const s = n, a = v, c = Z(), i = ce(c), B = Ve();
|
|
122
|
+
ue();
|
|
123
|
+
const l = oe("webx-reviews"), V = se(), k = W(null), g = W({}), C = W(""), q = W(s.id !== null), d = W(!1), T = W({}), b = y(() => c.can("reviews.manage")), L = y(() => JSON.stringify(g.value)), m = y(() => C.value !== "" && L.value !== C.value), O = y(() => d.value ? "saving" : m.value || s.id === null ? "unsaved" : "saved"), H = y(() => {
|
|
124
|
+
const o = g.value.name, h = s.id === null ? l("review.new") : k.value?.name ?? "";
|
|
125
|
+
return Le(o, B.active.value, h) || l("review.untitled");
|
|
126
|
+
});
|
|
127
|
+
function P(o) {
|
|
128
|
+
k.value = o.review, g.value = o.values, C.value = JSON.stringify(o.values);
|
|
129
|
+
}
|
|
130
|
+
if (s.id === null) {
|
|
131
|
+
const o = {
|
|
132
|
+
name: {},
|
|
133
|
+
job_title: {},
|
|
134
|
+
text: {},
|
|
135
|
+
published: !1,
|
|
136
|
+
categories: s.category === null ? [] : [s.category]
|
|
137
|
+
};
|
|
138
|
+
g.value = o, C.value = JSON.stringify(o);
|
|
139
|
+
}
|
|
140
|
+
async function j() {
|
|
141
|
+
if (s.id !== null) {
|
|
142
|
+
q.value = !0;
|
|
143
|
+
try {
|
|
144
|
+
P(await i.get(s.id));
|
|
145
|
+
} catch (o) {
|
|
146
|
+
_.danger(V(o)), a("back");
|
|
147
|
+
} finally {
|
|
148
|
+
q.value = !1;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async function E() {
|
|
153
|
+
if (!(d.value || !b.value)) {
|
|
154
|
+
d.value = !0, T.value = {};
|
|
155
|
+
try {
|
|
156
|
+
const o = s.id === null, h = o ? await i.create(g.value) : await i.save(s.id, g.value);
|
|
157
|
+
P(h), _.success(l("review.saved")), a(o ? "created" : "saved", h.review);
|
|
158
|
+
} catch (o) {
|
|
159
|
+
const h = o.body;
|
|
160
|
+
h?.errors ? (T.value = h.errors, _.danger(l("review.save-failed"))) : _.danger(V(o));
|
|
161
|
+
} finally {
|
|
162
|
+
d.value = !1;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
async function R() {
|
|
167
|
+
const o = k.value;
|
|
168
|
+
if (!(!o || !await X({
|
|
169
|
+
title: l("review.delete-title", { name: o.name }),
|
|
170
|
+
message: l("review.delete-text"),
|
|
171
|
+
confirmText: l("review.delete"),
|
|
172
|
+
cancelText: l("review.cancel"),
|
|
173
|
+
tone: "danger"
|
|
174
|
+
})))
|
|
175
|
+
try {
|
|
176
|
+
await i.remove(o.id), _.success(l("review.deleted")), C.value = L.value, a("removed", o.id);
|
|
177
|
+
} catch (I) {
|
|
178
|
+
_.danger(V(I));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function A(o) {
|
|
182
|
+
m.value && o.preventDefault();
|
|
183
|
+
}
|
|
184
|
+
function K(o) {
|
|
185
|
+
(o.ctrlKey || o.metaKey) && o.key.toLowerCase() === "s" && (o.preventDefault(), (m.value || s.id === null) && E());
|
|
186
|
+
}
|
|
187
|
+
We(() => {
|
|
188
|
+
j(), window.addEventListener("beforeunload", A);
|
|
189
|
+
}), ne(() => {
|
|
190
|
+
window.removeEventListener("beforeunload", A);
|
|
191
|
+
});
|
|
192
|
+
async function z() {
|
|
193
|
+
return !m.value || !b.value ? !0 : await X({
|
|
194
|
+
title: l("review.leave-title"),
|
|
195
|
+
message: l("review.leave-text"),
|
|
196
|
+
confirmText: l("review.leave"),
|
|
197
|
+
cancelText: l("review.cancel"),
|
|
198
|
+
tone: "danger"
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
qe(
|
|
202
|
+
async (o, h) => o.query.review === h.query.review ? !0 : await z()
|
|
203
|
+
), $e(z);
|
|
204
|
+
const J = y(
|
|
205
|
+
() => b.value && k.value !== null ? [
|
|
206
|
+
{
|
|
207
|
+
key: "delete",
|
|
208
|
+
label: l("review.delete"),
|
|
209
|
+
icon: "trash",
|
|
210
|
+
danger: !0,
|
|
211
|
+
menu: !0,
|
|
212
|
+
run: () => {
|
|
213
|
+
R();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
] : []
|
|
217
|
+
);
|
|
218
|
+
return (o, h) => (u(), $("div", {
|
|
219
|
+
class: "wx-review",
|
|
220
|
+
onKeydown: K
|
|
221
|
+
}, [
|
|
222
|
+
q.value ? (u(), x(t(ve), {
|
|
223
|
+
key: 0,
|
|
224
|
+
class: "wx-review__ghost",
|
|
225
|
+
title: "",
|
|
226
|
+
rows: 6
|
|
227
|
+
})) : (u(), $(Q, { key: 1 }, [
|
|
228
|
+
f(t(fe), {
|
|
229
|
+
level: 3,
|
|
230
|
+
back: !s.inline,
|
|
231
|
+
"back-label": t(l)("review.back"),
|
|
232
|
+
title: H.value,
|
|
233
|
+
actions: J.value,
|
|
234
|
+
"collapse-below": 480,
|
|
235
|
+
onBack: h[0] || (h[0] = (I) => a("back"))
|
|
236
|
+
}, Te({ _: 2 }, [
|
|
237
|
+
k.value && !k.value.published ? {
|
|
238
|
+
name: "title-after",
|
|
239
|
+
fn: p(() => [
|
|
240
|
+
f(t(F), { dot: "" }, {
|
|
241
|
+
default: p(() => [
|
|
242
|
+
M(S(t(l)("review.not-published")), 1)
|
|
243
|
+
]),
|
|
244
|
+
_: 1
|
|
245
|
+
})
|
|
246
|
+
]),
|
|
247
|
+
key: "0"
|
|
248
|
+
} : void 0
|
|
249
|
+
]), 1032, ["back", "back-label", "title", "actions"]),
|
|
250
|
+
f(t(me), {
|
|
251
|
+
modelValue: g.value,
|
|
252
|
+
"onUpdate:modelValue": h[1] || (h[1] = (I) => g.value = I),
|
|
253
|
+
name: "reviews.form",
|
|
254
|
+
errors: T.value,
|
|
255
|
+
disabled: !b.value || d.value
|
|
256
|
+
}, null, 8, ["modelValue", "errors", "disabled"]),
|
|
257
|
+
b.value ? (u(), x(t(Pe), { key: 0 }, {
|
|
258
|
+
state: p(() => [
|
|
259
|
+
f(t(be), { state: O.value }, null, 8, ["state"])
|
|
260
|
+
]),
|
|
261
|
+
default: p(() => [
|
|
262
|
+
f(t(Ae), {
|
|
263
|
+
type: "primary",
|
|
264
|
+
loading: d.value,
|
|
265
|
+
disabled: !m.value && s.id !== null,
|
|
266
|
+
onClick: E
|
|
267
|
+
}, {
|
|
268
|
+
default: p(() => [
|
|
269
|
+
M(S(t(l)("review.save")), 1)
|
|
270
|
+
]),
|
|
271
|
+
_: 1
|
|
272
|
+
}, 8, ["loading", "disabled"])
|
|
273
|
+
]),
|
|
274
|
+
_: 1
|
|
275
|
+
})) : N("", !0)
|
|
276
|
+
], 64))
|
|
277
|
+
], 32));
|
|
278
|
+
}
|
|
279
|
+
}), de = (n, v) => {
|
|
280
|
+
const s = n.__vccOpts || n;
|
|
281
|
+
for (const [a, c] of v)
|
|
282
|
+
s[a] = c;
|
|
283
|
+
return s;
|
|
284
|
+
}, He = /* @__PURE__ */ de(Fe, [["__scopeId", "data-v-d5d4af03"]]), Ke = { class: "wx-reviews__bar" }, Ge = { class: "wx-review-row__body" }, Qe = { class: "wx-review-row__who" }, Xe = { class: "wx-review-row__name" }, Ye = ["aria-label"], Ze = {
|
|
285
|
+
key: 0,
|
|
286
|
+
class: "wx-review-row__job"
|
|
287
|
+
}, et = { class: "wx-review-row__facts" }, tt = ["aria-label"], at = /* @__PURE__ */ le({
|
|
288
|
+
__name: "ReviewsPage",
|
|
289
|
+
props: {
|
|
290
|
+
base: { default: "/reviews" }
|
|
291
|
+
},
|
|
292
|
+
setup(n) {
|
|
293
|
+
const v = Z(), s = ce(v), a = Ce(), c = Be();
|
|
294
|
+
ue();
|
|
295
|
+
const i = oe("webx-reviews"), B = se(), l = W([]), V = W([]), k = W(!0), g = y(() => v.can("reviews.manage")), C = y(
|
|
296
|
+
() => v.state.manifest?.modules.find((e) => e.id === "reviews")?.title ?? i("module.reviews")
|
|
297
|
+
), q = y({
|
|
298
|
+
get: () => a.query.view === "trashed" ? "trashed" : "",
|
|
299
|
+
set: (e) => {
|
|
300
|
+
const w = {
|
|
301
|
+
...a.query,
|
|
302
|
+
view: e === "" ? void 0 : String(e)
|
|
303
|
+
};
|
|
304
|
+
delete w.review, c.replace({ query: w });
|
|
305
|
+
}
|
|
306
|
+
}), d = y(() => q.value === "trashed"), T = y(() => {
|
|
307
|
+
const e = a.query.category;
|
|
308
|
+
return typeof e == "string" && e !== "" && Number(e) || null;
|
|
309
|
+
}), b = y(() => typeof a.query.q == "string" ? a.query.q : ""), L = W(b.value), m = y(() => {
|
|
310
|
+
const e = a.query.review;
|
|
311
|
+
return e === "new" ? g.value ? "new" : null : typeof e == "string" && e !== "" && Number(e) || null;
|
|
312
|
+
}), O = y({
|
|
313
|
+
get: () => m.value !== null,
|
|
314
|
+
set: (e) => {
|
|
315
|
+
e || J();
|
|
316
|
+
}
|
|
317
|
+
}), H = y(() => [
|
|
318
|
+
{ value: "", label: i("review.all") },
|
|
319
|
+
{ value: "trashed", label: i("review.trashed"), icon: "trash" }
|
|
320
|
+
]), P = xe(Y, () => ({
|
|
321
|
+
q: b.value,
|
|
322
|
+
category: T.value,
|
|
323
|
+
filtered: d.value
|
|
324
|
+
})), j = y(() => g.value && P.sortable.value), E = y(() => b.value !== "" ? i("review.empty-search") : d.value ? i("review.empty-bin") : i("review.empty"));
|
|
325
|
+
async function R() {
|
|
326
|
+
k.value = !0;
|
|
327
|
+
try {
|
|
328
|
+
const e = await s.list({
|
|
329
|
+
search: b.value,
|
|
330
|
+
category: d.value ? null : T.value,
|
|
331
|
+
trashed: d.value
|
|
332
|
+
});
|
|
333
|
+
l.value = e.data, V.value = e.filters.categories;
|
|
334
|
+
} catch (e) {
|
|
335
|
+
_.danger(B(e));
|
|
336
|
+
} finally {
|
|
337
|
+
k.value = !1;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
te(
|
|
341
|
+
() => [q.value, T.value, b.value],
|
|
342
|
+
() => {
|
|
343
|
+
R();
|
|
344
|
+
}
|
|
345
|
+
), R();
|
|
346
|
+
let A;
|
|
347
|
+
te(L, (e) => {
|
|
348
|
+
clearTimeout(A), A = setTimeout(() => {
|
|
349
|
+
c.replace({ query: { ...a.query, q: e.trim() === "" ? void 0 : e } });
|
|
350
|
+
}, 300);
|
|
351
|
+
}), ne(() => clearTimeout(A));
|
|
352
|
+
function K(e) {
|
|
353
|
+
c.replace({
|
|
354
|
+
query: { ...a.query, category: typeof e == "number" ? String(e) : void 0 }
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
function z(e) {
|
|
358
|
+
c.replace({ query: { ...a.query, review: String(e) } });
|
|
359
|
+
}
|
|
360
|
+
function J() {
|
|
361
|
+
const e = { ...a.query };
|
|
362
|
+
delete e.review, c.replace({ query: e });
|
|
363
|
+
}
|
|
364
|
+
function o(e) {
|
|
365
|
+
z(e.id), R();
|
|
366
|
+
}
|
|
367
|
+
async function h() {
|
|
368
|
+
try {
|
|
369
|
+
await P.move(l.value.map((e) => e.id));
|
|
370
|
+
} catch (e) {
|
|
371
|
+
_.danger(B(e, i("review.reorder-failed"))), await R();
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function I(e) {
|
|
375
|
+
return g.value ? d.value ? [
|
|
376
|
+
{
|
|
377
|
+
key: "restore",
|
|
378
|
+
icon: "refresh",
|
|
379
|
+
label: i("review.restore"),
|
|
380
|
+
run: () => {
|
|
381
|
+
he(e);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
] : [
|
|
385
|
+
{
|
|
386
|
+
key: "delete",
|
|
387
|
+
icon: "trash",
|
|
388
|
+
label: i("review.delete"),
|
|
389
|
+
danger: !0,
|
|
390
|
+
run: () => {
|
|
391
|
+
we(e);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
] : [];
|
|
395
|
+
}
|
|
396
|
+
async function we(e) {
|
|
397
|
+
if (await X({
|
|
398
|
+
title: i("review.delete-title", { name: e.name }),
|
|
399
|
+
message: i("review.delete-text"),
|
|
400
|
+
confirmText: i("review.delete"),
|
|
401
|
+
cancelText: i("review.cancel"),
|
|
402
|
+
tone: "danger"
|
|
403
|
+
}))
|
|
404
|
+
try {
|
|
405
|
+
await s.remove(e.id), _.success(i("review.deleted")), ee(e.id);
|
|
406
|
+
} catch (r) {
|
|
407
|
+
_.danger(B(r));
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function ee(e) {
|
|
411
|
+
m.value === e && J(), R();
|
|
412
|
+
}
|
|
413
|
+
async function he(e) {
|
|
414
|
+
try {
|
|
415
|
+
await s.restore(e.id), _.success(i("review.restored"));
|
|
416
|
+
} catch (w) {
|
|
417
|
+
_.danger(B(w));
|
|
418
|
+
} finally {
|
|
419
|
+
await R();
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
function pe(e) {
|
|
423
|
+
return e.published && e.locales.length === 0;
|
|
424
|
+
}
|
|
425
|
+
function ye(e) {
|
|
426
|
+
const w = Math.max(0, Math.min(5, Math.round(e)));
|
|
427
|
+
return "★".repeat(w) + "☆".repeat(5 - w);
|
|
428
|
+
}
|
|
429
|
+
return (e, w) => (u(), x(t(_e), {
|
|
430
|
+
view: q.value,
|
|
431
|
+
"onUpdate:view": w[4] || (w[4] = (r) => q.value = r),
|
|
432
|
+
title: C.value,
|
|
433
|
+
views: H.value,
|
|
434
|
+
card: !1
|
|
435
|
+
}, {
|
|
436
|
+
default: p(() => [
|
|
437
|
+
f(t(ze), {
|
|
438
|
+
class: "wx-reviews",
|
|
439
|
+
padding: "none"
|
|
440
|
+
}, {
|
|
441
|
+
default: p(() => [
|
|
442
|
+
f(t(Ie), {
|
|
443
|
+
open: O.value,
|
|
444
|
+
"onUpdate:open": w[3] || (w[3] = (r) => O.value = r),
|
|
445
|
+
class: "wx-reviews__panes",
|
|
446
|
+
"list-width": 360,
|
|
447
|
+
"detail-min": 460,
|
|
448
|
+
"detail-label": t(i)("module.reviews")
|
|
449
|
+
}, {
|
|
450
|
+
list: p(() => [
|
|
451
|
+
D("div", Ke, [
|
|
452
|
+
f(t(Me), {
|
|
453
|
+
modelValue: L.value,
|
|
454
|
+
"onUpdate:modelValue": w[0] || (w[0] = (r) => L.value = r),
|
|
455
|
+
class: "wx-reviews__search",
|
|
456
|
+
size: "sm",
|
|
457
|
+
clearable: "",
|
|
458
|
+
placeholder: t(i)("review.search"),
|
|
459
|
+
"aria-label": t(i)("review.search")
|
|
460
|
+
}, {
|
|
461
|
+
prefix: p(() => [
|
|
462
|
+
f(t(re), {
|
|
463
|
+
name: "search",
|
|
464
|
+
size: "sm"
|
|
465
|
+
})
|
|
466
|
+
]),
|
|
467
|
+
_: 1
|
|
468
|
+
}, 8, ["modelValue", "placeholder", "aria-label"]),
|
|
469
|
+
d.value ? N("", !0) : (u(), x(t(Ue), {
|
|
470
|
+
key: 0,
|
|
471
|
+
"model-value": T.value,
|
|
472
|
+
options: V.value.map((r) => ({ value: r.id, label: r.title })),
|
|
473
|
+
placeholder: t(i)("review.any-category"),
|
|
474
|
+
"aria-label": t(i)("review.filter-category"),
|
|
475
|
+
clearable: "",
|
|
476
|
+
size: "sm",
|
|
477
|
+
"onUpdate:modelValue": K
|
|
478
|
+
}, null, 8, ["model-value", "options", "placeholder", "aria-label"]))
|
|
479
|
+
]),
|
|
480
|
+
g.value && !d.value ? (u(), $("button", {
|
|
481
|
+
key: 0,
|
|
482
|
+
type: "button",
|
|
483
|
+
class: G(["wx-reviews__new", { "is-current": m.value === "new" }]),
|
|
484
|
+
onClick: w[1] || (w[1] = (r) => z("new"))
|
|
485
|
+
}, [
|
|
486
|
+
f(t(re), {
|
|
487
|
+
name: "plus",
|
|
488
|
+
size: "sm"
|
|
489
|
+
}),
|
|
490
|
+
M(" " + S(t(i)("review.new")), 1)
|
|
491
|
+
], 2)) : N("", !0),
|
|
492
|
+
k.value && l.value.length === 0 ? (u(), x(t(ve), {
|
|
493
|
+
key: 1,
|
|
494
|
+
class: "wx-reviews__loading",
|
|
495
|
+
rows: 5
|
|
496
|
+
})) : l.value.length === 0 ? (u(), x(t(ae), {
|
|
497
|
+
key: 2,
|
|
498
|
+
title: E.value,
|
|
499
|
+
description: !d.value && b.value === "" ? t(i)("review.empty-help") : void 0
|
|
500
|
+
}, null, 8, ["title", "description"])) : (u(), $(Q, { key: 3 }, [
|
|
501
|
+
f(t(De), {
|
|
502
|
+
modelValue: l.value,
|
|
503
|
+
"onUpdate:modelValue": w[2] || (w[2] = (r) => l.value = r),
|
|
504
|
+
class: G(["wx-reviews__list", { "is-loading": k.value }]),
|
|
505
|
+
plain: "",
|
|
506
|
+
"item-key": "id",
|
|
507
|
+
handle: j.value ? "grip" : "row",
|
|
508
|
+
"item-label": (r) => r.name,
|
|
509
|
+
disabled: !j.value,
|
|
510
|
+
onMove: h
|
|
511
|
+
}, {
|
|
512
|
+
default: p(({ item: r }) => [
|
|
513
|
+
(u(), x(Re(d.value ? "div" : "button"), {
|
|
514
|
+
type: d.value ? void 0 : "button",
|
|
515
|
+
class: G(["wx-review-row", { "is-current": m.value === r.id }]),
|
|
516
|
+
onClick: (U) => d.value ? void 0 : z(r.id)
|
|
517
|
+
}, {
|
|
518
|
+
default: p(() => [
|
|
519
|
+
f(t(Oe), {
|
|
520
|
+
class: "wx-review-row__photo",
|
|
521
|
+
src: r.photo?.thumb ?? void 0,
|
|
522
|
+
name: r.name,
|
|
523
|
+
size: "md"
|
|
524
|
+
}, null, 8, ["src", "name"]),
|
|
525
|
+
D("span", Ge, [
|
|
526
|
+
D("span", Qe, [
|
|
527
|
+
D("span", Xe, S(r.name), 1),
|
|
528
|
+
r.rating !== null ? (u(), $("span", {
|
|
529
|
+
key: 0,
|
|
530
|
+
class: "wx-review-row__stars",
|
|
531
|
+
role: "img",
|
|
532
|
+
"aria-label": `${r.rating} / 5`
|
|
533
|
+
}, S(ye(r.rating)), 9, Ye)) : N("", !0)
|
|
534
|
+
]),
|
|
535
|
+
r.job_title ? (u(), $("span", Ze, S(r.job_title), 1)) : N("", !0),
|
|
536
|
+
D("span", et, [
|
|
537
|
+
r.published ? pe(r) ? (u(), x(t(je), {
|
|
538
|
+
key: 1,
|
|
539
|
+
content: t(i)("review.visible-nowhere")
|
|
540
|
+
}, {
|
|
541
|
+
default: p(() => [
|
|
542
|
+
f(t(F), {
|
|
543
|
+
type: "warning",
|
|
544
|
+
dot: "",
|
|
545
|
+
size: "sm"
|
|
546
|
+
}, {
|
|
547
|
+
default: p(() => [
|
|
548
|
+
M(S(t(i)("review.not-published")), 1)
|
|
549
|
+
]),
|
|
550
|
+
_: 1
|
|
551
|
+
})
|
|
552
|
+
]),
|
|
553
|
+
_: 1
|
|
554
|
+
}, 8, ["content"])) : N("", !0) : (u(), x(t(F), {
|
|
555
|
+
key: 0,
|
|
556
|
+
dot: "",
|
|
557
|
+
size: "sm"
|
|
558
|
+
}, {
|
|
559
|
+
default: p(() => [
|
|
560
|
+
M(S(t(i)("review.not-published")), 1)
|
|
561
|
+
]),
|
|
562
|
+
_: 1
|
|
563
|
+
})),
|
|
564
|
+
(u(!0), $(Q, null, Ne(r.categories, (U) => (u(), x(t(F), {
|
|
565
|
+
key: U.id,
|
|
566
|
+
size: "sm",
|
|
567
|
+
round: ""
|
|
568
|
+
}, {
|
|
569
|
+
default: p(() => [
|
|
570
|
+
M(S(U.title), 1)
|
|
571
|
+
]),
|
|
572
|
+
_: 2
|
|
573
|
+
}, 1024))), 128)),
|
|
574
|
+
r.locales.length > 0 ? (u(), $("span", {
|
|
575
|
+
key: 2,
|
|
576
|
+
class: "wx-review-row__locales",
|
|
577
|
+
"aria-label": t(i)("review.seen-in", { locales: r.locales.join(", ") })
|
|
578
|
+
}, S(r.locales.join(" · ")), 9, tt)) : N("", !0)
|
|
579
|
+
])
|
|
580
|
+
])
|
|
581
|
+
]),
|
|
582
|
+
_: 2
|
|
583
|
+
}, 1032, ["type", "class", "onClick"]))
|
|
584
|
+
]),
|
|
585
|
+
actions: p(({ item: r }) => [
|
|
586
|
+
f(t(ke), {
|
|
587
|
+
actions: I(r),
|
|
588
|
+
label: r.name
|
|
589
|
+
}, null, 8, ["actions", "label"])
|
|
590
|
+
]),
|
|
591
|
+
_: 1
|
|
592
|
+
}, 8, ["modelValue", "class", "handle", "item-label", "disabled"]),
|
|
593
|
+
g.value && !d.value ? (u(), x(t(Ee), {
|
|
594
|
+
key: 0,
|
|
595
|
+
class: "wx-reviews__note",
|
|
596
|
+
type: "info",
|
|
597
|
+
description: t(P).hint.value
|
|
598
|
+
}, null, 8, ["description"])) : N("", !0)
|
|
599
|
+
], 64))
|
|
600
|
+
]),
|
|
601
|
+
detail: p(({ inline: r, back: U }) => [
|
|
602
|
+
m.value !== null ? (u(), x(He, {
|
|
603
|
+
id: m.value === "new" ? null : m.value,
|
|
604
|
+
key: String(m.value),
|
|
605
|
+
category: T.value,
|
|
606
|
+
inline: r,
|
|
607
|
+
onBack: U,
|
|
608
|
+
onSaved: R,
|
|
609
|
+
onCreated: o,
|
|
610
|
+
onRemoved: ee
|
|
611
|
+
}, null, 8, ["id", "category", "inline", "onBack"])) : N("", !0)
|
|
612
|
+
]),
|
|
613
|
+
empty: p(() => [
|
|
614
|
+
f(t(ae), {
|
|
615
|
+
title: t(i)("review.choose"),
|
|
616
|
+
description: g.value ? t(i)("review.choose-help") : void 0
|
|
617
|
+
}, null, 8, ["title", "description"])
|
|
618
|
+
]),
|
|
619
|
+
_: 1
|
|
620
|
+
}, 8, ["open", "detail-label"])
|
|
621
|
+
]),
|
|
622
|
+
_: 1
|
|
623
|
+
})
|
|
624
|
+
]),
|
|
625
|
+
_: 1
|
|
626
|
+
}, 8, ["view", "title", "views"]));
|
|
627
|
+
}
|
|
628
|
+
}), rt = /* @__PURE__ */ de(at, [["__scopeId", "data-v-572ff29d"]]);
|
|
629
|
+
function it(n = "/reviews") {
|
|
630
|
+
return {
|
|
631
|
+
api: "reviews/categories",
|
|
632
|
+
path: `${n}/categories`,
|
|
633
|
+
name: "webx.reviews.categories",
|
|
634
|
+
module: "review-categories",
|
|
635
|
+
screen: "reviews.category-form",
|
|
636
|
+
manage: "reviews.categories.manage",
|
|
637
|
+
count: "reviews_count",
|
|
638
|
+
// The list narrowed to one category is also where its own order is dragged.
|
|
639
|
+
items: (v) => ({ path: n, query: { category: String(v) } }),
|
|
640
|
+
words: {
|
|
641
|
+
new: "webx-reviews::category.new",
|
|
642
|
+
empty: "webx-reviews::category.empty",
|
|
643
|
+
"empty-help": "webx-reviews::category.empty-help",
|
|
644
|
+
order: "webx-reviews::category.order",
|
|
645
|
+
hidden: "webx-reviews::category.hidden",
|
|
646
|
+
count: "webx-reviews::category.reviews",
|
|
647
|
+
"show-items": "webx-reviews::category.show-reviews",
|
|
648
|
+
"delete-blocked": "webx-reviews::category.delete-blocked",
|
|
649
|
+
"delete-text": "webx-reviews::category.delete-text",
|
|
650
|
+
deleted: "webx-reviews::category.deleted",
|
|
651
|
+
saved: "webx-reviews::category.saved",
|
|
652
|
+
"field-title": "webx-reviews::category.field-title"
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
function vt(n = {}) {
|
|
657
|
+
const v = n.path ?? "/reviews";
|
|
658
|
+
return [
|
|
659
|
+
{
|
|
660
|
+
id: "reviews",
|
|
661
|
+
path: v,
|
|
662
|
+
// One route: the open review is in the address (`?review=`), beside the list it was opened
|
|
663
|
+
// from, so a link to it is a link to both.
|
|
664
|
+
routes: [{ path: v, name: "webx.reviews", component: rt, props: { base: v } }]
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
id: "review-categories",
|
|
668
|
+
path: `${v}/categories`,
|
|
669
|
+
routes: Se(it(v))
|
|
670
|
+
}
|
|
671
|
+
];
|
|
672
|
+
}
|
|
673
|
+
export {
|
|
674
|
+
Y as REVIEWS_API,
|
|
675
|
+
He as WxReviewPane,
|
|
676
|
+
rt as WxReviewsPage,
|
|
677
|
+
ce as createReviewsApi,
|
|
678
|
+
it as reviewCategoriesOptions,
|
|
679
|
+
vt as reviews,
|
|
680
|
+
Je as reviewsMessages
|
|
681
|
+
};
|
|
682
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/api.ts","../src/messages.ts","../src/i18n.ts","../src/ReviewPane.vue","../src/ReviewsPage.vue","../src/module.ts"],"sourcesContent":["import { reorderItems, type AdminContext } from '@webx-ui/module-admin'\nimport type { ScreenModel } from '@webx-ui/schema'\nimport type { ReviewDetail, ReviewQuery, ReviewRow, ReviewsList } from './types'\n\nexport interface ReviewsApi {\n /** Every review, with the categories the list can be narrowed to. */\n list(query?: ReviewQuery): Promise<ReviewsList>\n get(id: number): Promise<ReviewDetail>\n /**\n * A new review out of the values of its form, in one request: the form is filled in first and\n * the record made on the first save, so nobody leaves an empty review behind.\n */\n create(values: ScreenModel): Promise<ReviewDetail>\n /** Refused with a 422 under the name of the field. */\n save(id: number, values: ScreenModel): Promise<ReviewDetail>\n remove(id: number): Promise<void>\n restore(id: number): Promise<ReviewRow>\n /** The order on screen: of the whole list, or — with `category` — of that category alone. */\n reorder(ids: number[], category?: number | null): Promise<void>\n}\n\n/** The path of the list under the panel's API, and of its order (`CategoryRoutes::items()`). */\nexport const REVIEWS_API = 'reviews'\n\n/**\n * Everything under `/reviews`, below the panel's API path — except the categories, which are the\n * panel's shared ones and are asked for with `createCategoriesApi(admin, 'reviews/categories')`.\n */\nexport function createReviewsApi(admin: AdminContext): ReviewsApi {\n const base = `${admin.apiPath}/${REVIEWS_API}`\n const data = <T>(body: { data: T }): T => body.data\n\n return {\n list: (query = {}) => {\n const search = new URLSearchParams()\n\n // Only what was asked for: `category=` would ask for the reviews of no category.\n if (query.search) search.set('search', query.search)\n if (query.category != null) search.set('category', String(query.category))\n if (query.trashed) search.set('trashed', '1')\n\n return admin.http.get<ReviewsList>(search.size > 0 ? `${base}?${search}` : base)\n },\n get: (id) => admin.http.get<{ data: ReviewDetail }>(`${base}/${id}`).then(data),\n create: (values) => admin.http.post<{ data: ReviewDetail }>(base, { values }).then(data),\n save: (id, values) =>\n admin.http.put<{ data: ReviewDetail }>(`${base}/${id}`, { values }).then(data),\n remove: (id) => admin.http.delete<void>(`${base}/${id}`).then(() => undefined),\n // The resource of the list line, and not the form's pair: a restored review stays closed.\n restore: (id) => admin.http.post<{ data: ReviewRow }>(`${base}/${id}/restore`, {}).then(data),\n reorder: (ids, category = null) => reorderItems(admin, REVIEWS_API, ids, category),\n }\n}\n","import type { Messages } from '@webx-ui/module-admin'\n\n/**\n * The English this package speaks on its own, before the server's dictionary arrives, or without\n * one. The server ships the same lines in ten languages under `webx-reviews::` and overrides\n * these; `messages.test.ts` keeps the two sets of keys equal.\n */\nexport const reviewsMessages: Record<string, Messages> = {\n module: {\n group: 'Reviews',\n reviews: 'Reviews',\n categories: 'Categories',\n },\n review: {\n new: 'New review',\n untitled: 'Untitled',\n search: 'Search the reviews',\n empty: 'No reviews yet.',\n 'empty-help': 'A review reaches the site in a reviews block, on any page.',\n 'empty-search': 'Nothing matches that.',\n 'empty-bin': 'The bin is empty.',\n all: 'All',\n trashed: 'Bin',\n 'filter-category': 'Category',\n 'any-category': 'Any category',\n 'not-published': 'Not published',\n 'visible-nowhere': 'Published, but seen in no language: it needs a text in one.',\n 'no-text': 'No text yet',\n 'no-rating': 'No rating',\n 'seen-in': 'Seen in: :locales',\n choose: 'Choose a review',\n 'choose-help': 'Or write a new one: the first line of the list.',\n save: 'Save',\n saved: 'The review is saved.',\n 'save-failed': 'The review was not saved.',\n cancel: 'Cancel',\n delete: 'Delete',\n 'delete-title': 'Delete the review by “:name”?',\n 'delete-text':\n 'It goes to the bin and leaves every block on the site. Restored, it comes back to its places.',\n deleted: 'The review is in the bin.',\n restore: 'Restore',\n restored: 'The review is back.',\n 'reorder-failed': 'The new order was not saved.',\n 'leave-title': 'Leave without saving?',\n 'leave-text': 'What you wrote in this review is not on the server.',\n leave: 'Leave',\n back: 'Back to the list',\n },\n screen: {\n author: 'Who wrote it',\n photo: 'Photo',\n 'photo-help': 'Without one, the site shows the initials of the name.',\n name: 'Name',\n 'name-help': 'Not written in a language, it is shown as written in the default one.',\n 'job-title': 'Job title',\n 'job-title-help': 'Or the company, or the city: whatever is printed under the name.',\n 'profile-url': 'Link to a profile',\n 'profile-url-help':\n 'An address starting with http:// or https://. The name becomes a link to it.',\n review: 'Review',\n text: 'Text',\n 'text-help': 'A review is shown in a language only when it has a text in it.',\n rating: 'Rating',\n 'rating-help': 'From one star to five. No stars, no rating shown.',\n 'reviewed-on': 'Date',\n 'reviewed-on-help':\n 'Shown if the block prints it; it changes neither the order nor who sees the review.',\n settings: 'Settings',\n published: 'Published',\n 'published-help':\n 'On the site in every block that shows its categories, from the moment it is saved.',\n categories: 'Categories',\n 'categories-help': 'What a block picks the review by, and the buttons of its filter.',\n },\n category: {\n 'field-title': 'Title',\n visible: 'Shown on the site',\n 'visible-help':\n 'Hidden, it drops out of every filter; its reviews stay in the blocks that show them.',\n new: 'New category',\n empty: 'No categories yet.',\n 'empty-help':\n 'A category groups reviews: a block shows the ones you pick, and its filter has a button for each.',\n order: 'Drag to change the order of the filter buttons on the site.',\n hidden: 'Hidden from the site',\n reviews: 'Reviews: :count',\n 'show-reviews': 'Show its reviews',\n 'delete-blocked': 'This category still holds reviews. Move them first.',\n 'delete-text': 'It goes to the bin and its button leaves every filter. Its reviews stay.',\n deleted: 'The category is in the bin.',\n saved: 'The category is saved.',\n },\n}\n","import { useAdmin } from '@webx-ui/module-admin'\nimport { reviewsMessages } from './messages'\n\nconst seeded = new WeakSet<object>()\n\n/** Puts this package's English under the panel's dictionary, once per panel. */\nexport function useReviewsMessages(): void {\n try {\n const { i18n } = useAdmin()\n\n if (!seeded.has(i18n)) {\n i18n.defaults('webx-reviews', reviewsMessages)\n seeded.add(i18n)\n }\n } catch {\n // Outside a panel there is no dictionary to seed, and `useTranslate` falls back on its own.\n }\n}\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref } from 'vue'\nimport { onBeforeRouteLeave, onBeforeRouteUpdate, type RouteLocationNormalized } from 'vue-router'\nimport {\n confirm,\n localizedValue,\n toast,\n useLocales,\n WxActionBar,\n WxBadge,\n WxButton,\n WxSkeleton,\n type LocalizedValue,\n} from '@webx-ui/core'\nimport {\n useAdmin,\n useErrorText,\n useTranslate,\n WxSaveState,\n WxScreen,\n WxScreenHead,\n type ScreenAction,\n} from '@webx-ui/module-admin'\nimport type { ScreenModel } from '@webx-ui/schema'\nimport { createReviewsApi } from './api'\nimport { useReviewsMessages } from './i18n'\nimport type { ReviewDetail, ReviewSummary } from './types'\n\n/**\n * One review: the pane beside the list, and the whole screen on a phone.\n *\n * The described screen `reviews.form` with a head over it and one button under it. One explicit\n * save, and no autosave: a review has no draft (decision 10), so what is saved is on the site at\n * once — the button is the moment somebody decides it is ready.\n *\n * A new review is a form first and a record on the first save: an empty row made by pressing\n * \"New review\" and walking away would be a review with nothing in it on the list for ever.\n *\n * The way back is drawn here and not by the pane around it: the drawer a narrow screen opens\n * this in has no close of its own on purpose (CLAUDE.md §4).\n */\ndefineOptions({ name: 'WxReviewPane' })\n\nconst props = withDefaults(\n defineProps<{\n /** `null` — a review not written yet. */\n id: number | null\n /** The category the list is narrowed to: a new review starts in it. */\n category?: number | null\n /** False in the drawer a narrow screen opens this in. */\n inline?: boolean\n }>(),\n { category: null, inline: true },\n)\n\nconst emit = defineEmits<{\n back: []\n /** The review was written; the list redraws its row. */\n saved: [review: ReviewSummary]\n /** The first save of a new review: it is a record now, with an id to be opened by. */\n created: [review: ReviewSummary]\n removed: [id: number]\n}>()\n\nconst context = useAdmin()\nconst api = createReviewsApi(context)\nconst locales = useLocales()\nuseReviewsMessages()\n\nconst t = useTranslate('webx-reviews')\n/* Not the server's `message`: the panel says how a request failed in its own words. */\nconst message = useErrorText()\n\nconst review = ref<ReviewSummary | null>(null)\nconst values = ref<ScreenModel>({})\nconst snapshot = ref('')\n\nconst loading = ref(props.id !== null)\nconst saving = ref(false)\nconst errors = ref<Record<string, string[]>>({})\n\nconst canManage = computed(() => context.can('reviews.manage'))\n\nconst current = computed(() => JSON.stringify(values.value))\nconst dirty = computed(() => snapshot.value !== '' && current.value !== snapshot.value)\n\nconst state = computed<'saving' | 'unsaved' | 'saved'>(() => {\n if (saving.value) return 'saving'\n\n return dirty.value || props.id === null ? 'unsaved' : 'saved'\n})\n\n/** The name follows the field rather than the answer: an edit shows at the top as it is typed. */\nconst title = computed(() => {\n const written = values.value.name as LocalizedValue | string | null | undefined\n const fallback = props.id === null ? t('review.new') : (review.value?.name ?? '')\n\n return localizedValue(written, locales.active.value, fallback) || t('review.untitled')\n})\n\nfunction take(detail: ReviewDetail): void {\n review.value = detail.review\n values.value = detail.values\n snapshot.value = JSON.stringify(detail.values)\n}\n\nif (props.id === null) {\n // What the server would answer for a review with nothing in it yet.\n const blank: ScreenModel = {\n name: {},\n job_title: {},\n text: {},\n published: false,\n categories: props.category === null ? [] : [props.category],\n }\n\n values.value = blank\n snapshot.value = JSON.stringify(blank)\n}\n\nasync function load(): Promise<void> {\n if (props.id === null) return\n\n loading.value = true\n\n try {\n take(await api.get(props.id))\n } catch (error) {\n toast.danger(message(error))\n emit('back')\n } finally {\n loading.value = false\n }\n}\n\nasync function save(): Promise<void> {\n if (saving.value || !canManage.value) return\n\n saving.value = true\n errors.value = {}\n\n try {\n const made = props.id === null\n const detail = made\n ? await api.create(values.value)\n : await api.save(props.id as number, values.value)\n\n take(detail)\n toast.success(t('review.saved'))\n if (made) emit('created', detail.review)\n else emit('saved', detail.review)\n } catch (error) {\n const body = (error as { body?: { errors?: Record<string, string[]> } }).body\n\n if (body?.errors) {\n errors.value = body.errors\n toast.danger(t('review.save-failed'))\n } else {\n toast.danger(message(error))\n }\n } finally {\n saving.value = false\n }\n}\n\nasync function remove(): Promise<void> {\n const record = review.value\n\n if (!record) return\n\n const agreed = await confirm({\n title: t('review.delete-title', { name: record.name }),\n message: t('review.delete-text'),\n confirmText: t('review.delete'),\n cancelText: t('review.cancel'),\n tone: 'danger',\n })\n\n if (!agreed) return\n\n try {\n await api.remove(record.id)\n toast.success(t('review.deleted'))\n // Nothing left to protect: the record is in the bin.\n snapshot.value = current.value\n emit('removed', record.id)\n } catch (error) {\n toast.danger(message(error))\n }\n}\n\n/* The browser's own guard: it cannot wait for a request, so all it can do is ask. */\nfunction leaveGuard(event: BeforeUnloadEvent): void {\n if (dirty.value) event.preventDefault()\n}\n\n/* Ctrl+S saves, as it does everywhere else that has a save button. */\nfunction onKeydown(event: KeyboardEvent): void {\n if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 's') {\n event.preventDefault()\n if (dirty.value || props.id === null) void save()\n }\n}\n\nonMounted(() => {\n void load()\n window.addEventListener('beforeunload', leaveGuard)\n})\n\nonBeforeUnmount(() => {\n window.removeEventListener('beforeunload', leaveGuard)\n})\n\nasync function mayLeave(): Promise<boolean> {\n if (!dirty.value || !canManage.value) return true\n\n return await confirm({\n title: t('review.leave-title'),\n message: t('review.leave-text'),\n confirmText: t('review.leave'),\n cancelText: t('review.cancel'),\n tone: 'danger',\n })\n}\n\n/*\n * The list and this form are one route, so another review is an update of it rather than a way\n * out — and so is every keystroke in the search above the list, which goes into the address too.\n * Only a change of the review asks.\n */\nonBeforeRouteUpdate(async (to: RouteLocationNormalized, from: RouteLocationNormalized) =>\n to.query.review === from.query.review ? true : await mayLeave(),\n)\n\nonBeforeRouteLeave(mayLeave)\n\n/* What leads away from the review. On a narrow pane the head folds them into the ···. */\nconst actions = computed<ScreenAction[]>(() =>\n canManage.value && review.value !== null\n ? [\n {\n key: 'delete',\n label: t('review.delete'),\n icon: 'trash',\n danger: true,\n menu: true,\n run: () => void remove(),\n },\n ]\n : [],\n)\n</script>\n\n<template>\n <div class=\"wx-review\" @keydown=\"onKeydown\">\n <wx-skeleton v-if=\"loading\" class=\"wx-review__ghost\" title :rows=\"6\" />\n\n <template v-else>\n <wx-screen-head\n :level=\"3\"\n :back=\"!props.inline\"\n :back-label=\"t('review.back')\"\n :title=\"title\"\n :actions=\"actions\"\n :collapse-below=\"480\"\n @back=\"emit('back')\"\n >\n <template v-if=\"review && !review.published\" #title-after>\n <wx-badge dot>{{ t('review.not-published') }}</wx-badge>\n </template>\n </wx-screen-head>\n\n <wx-screen\n v-model=\"values\"\n name=\"reviews.form\"\n :errors=\"errors\"\n :disabled=\"!canManage || saving\"\n />\n\n <wx-action-bar v-if=\"canManage\">\n <template #state>\n <wx-save-state :state=\"state\" />\n </template>\n\n <wx-button\n type=\"primary\"\n :loading=\"saving\"\n :disabled=\"!dirty && props.id !== null\"\n @click=\"save\"\n >\n {{ t('review.save') }}\n </wx-button>\n </wx-action-bar>\n </template>\n </div>\n</template>\n\n<style scoped>\n.wx-review {\n display: flex;\n flex-direction: column;\n gap: var(--wx-gap, var(--wx-space-16));\n min-width: 0;\n padding: var(--wx-gap, var(--wx-space-16));\n container-type: inline-size;\n}\n\n.wx-review__ghost {\n max-width: 480px;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { useRoute, useRouter, type LocationQueryRaw } from 'vue-router'\nimport {\n confirm,\n toast,\n WxAlert,\n WxAvatar,\n WxBadge,\n WxCard,\n WxEmpty,\n WxIcon,\n WxInput,\n WxListDetail,\n WxSelect,\n WxSkeleton,\n WxSortableList,\n WxTooltip,\n type TabItem,\n type TabValue,\n} from '@webx-ui/core'\nimport {\n useAdmin,\n useErrorText,\n useItemOrder,\n useTranslate,\n WxListScreen,\n WxRowMenu,\n type RowAction,\n} from '@webx-ui/module-admin'\nimport { createReviewsApi, REVIEWS_API } from './api'\nimport { useReviewsMessages } from './i18n'\nimport ReviewPane from './ReviewPane.vue'\nimport type { ReviewCategoryRef, ReviewRow, ReviewSummary } from './types'\n\n/**\n * The reviews: all of them on the left, the one being written on the right (§4.6, decision 11).\n *\n * The same shape as the FAQ, for the same reason: a review is typed in from a message in a\n * minute, and the next one is usually the one under it — a round trip through a page of its own\n * for every review is most of the time spent. On a phone the form is the whole screen, in the\n * drawer `WxListDetail` raises, and draws its own way back.\n *\n * The order is decision 6: without a filter a drag moves the common order; narrowed to one\n * category, the category's own; a search or the bin shows a selection, so the grips go away and\n * the line under the list says why.\n *\n * Everything the screen is looking at lives in the address — the view, the category, the search\n * and the open review — so a link to a review is a link to it in its list.\n */\nwithDefaults(defineProps<{ base?: string }>(), { base: '/reviews' })\n\nconst context = useAdmin()\nconst api = createReviewsApi(context)\nconst route = useRoute()\nconst router = useRouter()\nuseReviewsMessages()\n\nconst t = useTranslate('webx-reviews')\n/* Not the server's `message`: the panel says how a request failed in its own words. */\nconst message = useErrorText()\n\nconst rows = ref<ReviewRow[]>([])\nconst categories = ref<ReviewCategoryRef[]>([])\nconst loading = ref(true)\n\nconst canManage = computed(() => context.can('reviews.manage'))\n\nconst title = computed(\n () =>\n context.state.manifest?.modules.find((module) => module.id === 'reviews')?.title ??\n t('module.reviews'),\n)\n\nconst view = computed<TabValue>({\n get: () => (route.query.view === 'trashed' ? 'trashed' : ''),\n set: (value) => {\n const query: LocationQueryRaw = {\n ...route.query,\n view: value === '' ? undefined : String(value),\n }\n\n // A review from the list is not a review from the bin: the form closes with the view.\n delete query.review\n void router.replace({ query })\n },\n})\n\nconst inBin = computed(() => view.value === 'trashed')\n\nconst category = computed<number | null>(() => {\n const raw = route.query.category\n\n return typeof raw === 'string' && raw !== '' ? Number(raw) || null : null\n})\n\nconst q = computed(() => (typeof route.query.q === 'string' ? route.query.q : ''))\n\n/* What is typed, ahead of the address: the address follows it after a pause. */\nconst typed = ref(q.value)\n\n/** The open review: a number, `'new'` for one not yet saved, or nothing. */\nconst selected = computed<number | 'new' | null>(() => {\n const raw = route.query.review\n\n if (raw === 'new') return canManage.value ? 'new' : null\n\n return typeof raw === 'string' && raw !== '' ? Number(raw) || null : null\n})\n\n/*\n * Open is \"a review is chosen\", and closing is un-choosing it — so the address, the list's\n * highlight and the drawer on a phone can never disagree about it.\n */\nconst open = computed({\n get: () => selected.value !== null,\n set: (value) => {\n if (!value) close()\n },\n})\n\nconst views = computed<TabItem[]>(() => [\n { value: '', label: t('review.all') },\n { value: 'trashed', label: t('review.trashed'), icon: 'trash' },\n])\n\nconst order = useItemOrder(REVIEWS_API, () => ({\n q: q.value,\n category: category.value,\n filtered: inBin.value,\n}))\n\n/* Dragged only by somebody who may write, and only in a list that is a whole order. */\nconst sortable = computed(() => canManage.value && order.sortable.value)\n\nconst emptyText = computed(() => {\n if (q.value !== '') return t('review.empty-search')\n\n return inBin.value ? t('review.empty-bin') : t('review.empty')\n})\n\nasync function load(): Promise<void> {\n loading.value = true\n\n try {\n const answer = await api.list({\n search: q.value,\n category: inBin.value ? null : category.value,\n trashed: inBin.value,\n })\n\n rows.value = answer.data\n categories.value = answer.filters.categories\n } catch (error) {\n toast.danger(message(error))\n } finally {\n loading.value = false\n }\n}\n\nwatch(\n () => [view.value, category.value, q.value] as const,\n () => void load(),\n)\nvoid load()\n\nlet pause: ReturnType<typeof setTimeout> | undefined\n\nwatch(typed, (value) => {\n clearTimeout(pause)\n pause = setTimeout(() => {\n void router.replace({ query: { ...route.query, q: value.trim() === '' ? undefined : value } })\n }, 300)\n})\n\nonBeforeUnmount(() => clearTimeout(pause))\n\nfunction narrow(value: unknown): void {\n void router.replace({\n query: { ...route.query, category: typeof value === 'number' ? String(value) : undefined },\n })\n}\n\n/* `replace` and not `push`: going through twenty reviews is not twenty steps of history. */\nfunction choose(id: number | 'new'): void {\n void router.replace({ query: { ...route.query, review: String(id) } })\n}\n\nfunction close(): void {\n const query = { ...route.query }\n\n delete query.review\n void router.replace({ query })\n}\n\n/** A new review was saved: it is a record now, and the list has it. */\nfunction created(review: ReviewSummary): void {\n choose(review.id)\n void load()\n}\n\n/**\n * The order on screen, written as a whole — the list or the category's, whichever this is. The\n * list is already in its new order (`WxSortableList` reorders the model before it says so), so a\n * failure has to put it back rather than leave the screen disagreeing with the database.\n */\nasync function reorder(): Promise<void> {\n try {\n await order.move(rows.value.map((row) => row.id))\n } catch (error) {\n toast.danger(message(error, t('review.reorder-failed')))\n await load()\n }\n}\n\nfunction actionsFor(row: ReviewRow): RowAction[] {\n if (!canManage.value) return []\n\n if (inBin.value) {\n return [\n {\n key: 'restore',\n icon: 'refresh',\n label: t('review.restore'),\n run: () => void restore(row),\n },\n ]\n }\n\n return [\n {\n key: 'delete',\n icon: 'trash',\n label: t('review.delete'),\n danger: true,\n run: () => void remove(row),\n },\n ]\n}\n\nasync function remove(row: ReviewRow): Promise<void> {\n const agreed = await confirm({\n title: t('review.delete-title', { name: row.name }),\n message: t('review.delete-text'),\n confirmText: t('review.delete'),\n cancelText: t('review.cancel'),\n tone: 'danger',\n })\n\n if (!agreed) return\n\n try {\n await api.remove(row.id)\n toast.success(t('review.deleted'))\n removed(row.id)\n } catch (error) {\n toast.danger(message(error))\n }\n}\n\n/** Gone from the list; and if it was the open one, the form goes with it. */\nfunction removed(id: number): void {\n if (selected.value === id) close()\n\n void load()\n}\n\nasync function restore(row: ReviewRow): Promise<void> {\n try {\n await api.restore(row.id)\n toast.success(t('review.restored'))\n } catch (error) {\n toast.danger(message(error))\n } finally {\n await load()\n }\n}\n\n/* Published and yet shown in no language: the one state the list has to point out. */\nfunction unseen(row: ReviewRow): boolean {\n return row.published && row.locales.length === 0\n}\n\n/* Five places, the rating's filled: text rather than `WxRate`, which is a control, and a control\n inside the row's button is a button in a button. */\nfunction stars(rating: number): string {\n const whole = Math.max(0, Math.min(5, Math.round(rating)))\n\n return '★'.repeat(whole) + '☆'.repeat(5 - whole)\n}\n</script>\n\n<template>\n <wx-list-screen v-model:view=\"view\" :title=\"title\" :views=\"views\" :card=\"false\">\n <wx-card class=\"wx-reviews\" padding=\"none\">\n <wx-list-detail\n v-model:open=\"open\"\n class=\"wx-reviews__panes\"\n :list-width=\"360\"\n :detail-min=\"460\"\n :detail-label=\"t('module.reviews')\"\n >\n <template #list>\n <div class=\"wx-reviews__bar\">\n <wx-input\n v-model=\"typed\"\n class=\"wx-reviews__search\"\n size=\"sm\"\n clearable\n :placeholder=\"t('review.search')\"\n :aria-label=\"t('review.search')\"\n >\n <template #prefix><wx-icon name=\"search\" size=\"sm\" /></template>\n </wx-input>\n\n <!-- Always in sight rather than behind a funnel: it is the one filter that decides\n which order a drag writes, and the list says so right under it. -->\n <wx-select\n v-if=\"!inBin\"\n :model-value=\"category\"\n :options=\"categories.map((item) => ({ value: item.id, label: item.title }))\"\n :placeholder=\"t('review.any-category')\"\n :aria-label=\"t('review.filter-category')\"\n clearable\n size=\"sm\"\n @update:model-value=\"narrow\"\n />\n </div>\n\n <!--\n A line of the list rather than a button in the head: the new review is written where\n it will stand, beside the ones it joins — and the form opens the same way any other\n review's does.\n -->\n <button\n v-if=\"canManage && !inBin\"\n type=\"button\"\n class=\"wx-reviews__new\"\n :class=\"{ 'is-current': selected === 'new' }\"\n @click=\"choose('new')\"\n >\n <wx-icon name=\"plus\" size=\"sm\" />\n {{ t('review.new') }}\n </button>\n\n <wx-skeleton v-if=\"loading && rows.length === 0\" class=\"wx-reviews__loading\" :rows=\"5\" />\n\n <wx-empty\n v-else-if=\"rows.length === 0\"\n :title=\"emptyText\"\n :description=\"!inBin && q === '' ? t('review.empty-help') : undefined\"\n />\n\n <template v-else>\n <!-- A grip and not the whole row: the row opens a review, and a row that both opens\n and drags is one where one of the two happens by accident. -->\n <wx-sortable-list\n v-model=\"rows\"\n class=\"wx-reviews__list\"\n :class=\"{ 'is-loading': loading }\"\n plain\n item-key=\"id\"\n :handle=\"sortable ? 'grip' : 'row'\"\n :item-label=\"(item: ReviewRow) => item.name\"\n :disabled=\"!sortable\"\n @move=\"reorder\"\n >\n <template #default=\"{ item }\">\n <component\n :is=\"inBin ? 'div' : 'button'\"\n :type=\"inBin ? undefined : 'button'\"\n class=\"wx-review-row\"\n :class=\"{ 'is-current': selected === item.id }\"\n @click=\"inBin ? undefined : choose(item.id)\"\n >\n <wx-avatar\n class=\"wx-review-row__photo\"\n :src=\"item.photo?.thumb ?? undefined\"\n :name=\"item.name\"\n size=\"md\"\n />\n\n <span class=\"wx-review-row__body\">\n <span class=\"wx-review-row__who\">\n <span class=\"wx-review-row__name\">{{ item.name }}</span>\n <span\n v-if=\"item.rating !== null\"\n class=\"wx-review-row__stars\"\n role=\"img\"\n :aria-label=\"`${item.rating} / 5`\"\n >\n {{ stars(item.rating) }}\n </span>\n </span>\n\n <span v-if=\"item.job_title\" class=\"wx-review-row__job\">\n {{ item.job_title }}\n </span>\n\n <span class=\"wx-review-row__facts\">\n <wx-badge v-if=\"!item.published\" dot size=\"sm\">\n {{ t('review.not-published') }}\n </wx-badge>\n <wx-tooltip v-else-if=\"unseen(item)\" :content=\"t('review.visible-nowhere')\">\n <wx-badge type=\"warning\" dot size=\"sm\">\n {{ t('review.not-published') }}\n </wx-badge>\n </wx-tooltip>\n\n <wx-badge v-for=\"chip in item.categories\" :key=\"chip.id\" size=\"sm\" round>\n {{ chip.title }}\n </wx-badge>\n\n <span\n v-if=\"item.locales.length > 0\"\n class=\"wx-review-row__locales\"\n :aria-label=\"t('review.seen-in', { locales: item.locales.join(', ') })\"\n >\n {{ item.locales.join(' · ') }}\n </span>\n </span>\n </span>\n </component>\n </template>\n\n <template #actions=\"{ item }\">\n <wx-row-menu :actions=\"actionsFor(item)\" :label=\"item.name\" />\n </template>\n </wx-sortable-list>\n\n <!-- What a drag does here, or why there is nothing to drag. -->\n <wx-alert\n v-if=\"canManage && !inBin\"\n class=\"wx-reviews__note\"\n type=\"info\"\n :description=\"order.hint.value\"\n />\n </template>\n </template>\n\n <template #detail=\"{ inline, back }\">\n <review-pane\n v-if=\"selected !== null\"\n :id=\"selected === 'new' ? null : selected\"\n :key=\"String(selected)\"\n :category=\"category\"\n :inline=\"inline\"\n @back=\"back\"\n @saved=\"load\"\n @created=\"created\"\n @removed=\"removed\"\n />\n </template>\n\n <template #empty>\n <wx-empty\n :title=\"t('review.choose')\"\n :description=\"canManage ? t('review.choose-help') : undefined\"\n />\n </template>\n </wx-list-detail>\n </wx-card>\n </wx-list-screen>\n</template>\n\n<style>\n/*\n * What scrolls here is the page, the way it does on every other list of the panel. The card's\n * corners are the screen's, and the panes paint their own background to the edge: `clip`, not\n * `hidden`, which would make this a scroll container and pin everything sticky inside to a box\n * that never moves (CLAUDE.md §4).\n */\n.wx-reviews > .wx-card__body {\n display: flex;\n flex-direction: column;\n overflow: clip;\n border-radius: inherit;\n}\n</style>\n\n<style scoped>\n.wx-reviews__bar {\n display: flex;\n flex-wrap: wrap;\n gap: var(--wx-space-8);\n padding: var(--wx-space-12) var(--wx-space-12) var(--wx-space-8);\n}\n\n.wx-reviews__search {\n flex: 1 1 180px;\n min-width: 0;\n}\n\n/* The select is a fragment (it carries its dropdown beside it), so our scope attribute never\n reaches it: styled from our own wrapper (CLAUDE.md §4). */\n.wx-reviews__bar > :deep(.wx-select) {\n flex: 1 1 140px;\n min-width: 0;\n}\n\n.wx-reviews__new {\n display: flex;\n align-items: center;\n gap: var(--wx-space-8);\n width: calc(100% - 2 * var(--wx-space-8));\n margin: 0 var(--wx-space-8) var(--wx-space-4);\n padding: var(--wx-space-8);\n border: 1px dashed var(--wx-border-default);\n border-radius: var(--wx-radius-sm);\n background: none;\n font: inherit;\n color: var(--wx-color-primary);\n text-align: start;\n cursor: pointer;\n}\n\n.wx-reviews__new:hover,\n.wx-reviews__new.is-current {\n background: var(--wx-bg-subtle);\n}\n\n.wx-reviews__loading {\n padding: var(--wx-space-12);\n}\n\n.wx-reviews__list {\n padding-inline: var(--wx-space-8);\n}\n\n.wx-reviews__list.is-loading {\n opacity: 0.6;\n}\n\n.wx-reviews__list :deep(.wx-sortable-list__row) {\n gap: var(--wx-space-4);\n padding-inline: var(--wx-space-4);\n border-radius: var(--wx-radius-sm);\n}\n\n.wx-reviews__list :deep(.wx-sortable-list__row:hover),\n.wx-reviews__list :deep(.wx-sortable-list__row:has(.is-current)) {\n background: var(--wx-bg-subtle);\n}\n\n.wx-reviews__note {\n margin: var(--wx-space-8);\n}\n\n.wx-review-row {\n display: flex;\n align-items: flex-start;\n gap: var(--wx-space-10);\n /* The row is the target: a short name should not leave half the line dead — and a button,\n unlike a link, is only as wide as what is in it until it is told otherwise. */\n flex: 1 1 auto;\n width: 100%;\n min-width: 0;\n padding-block: var(--wx-space-8);\n padding-inline: 0;\n border: 0;\n background: none;\n font: inherit;\n color: inherit;\n text-align: start;\n}\n\nbutton.wx-review-row {\n cursor: pointer;\n}\n\n.wx-review-row__photo {\n flex: none;\n}\n\n.wx-review-row__body {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: var(--wx-space-2);\n min-width: 0;\n}\n\n.wx-review-row__who {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n column-gap: var(--wx-space-8);\n min-width: 0;\n}\n\n.wx-review-row__name {\n min-width: 0;\n overflow: hidden;\n font-weight: var(--wx-font-weight-medium);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.wx-review-row.is-current .wx-review-row__name {\n color: var(--wx-color-primary);\n}\n\n.wx-review-row__stars {\n flex: none;\n color: var(--wx-color-warning);\n font-size: var(--wx-font-size-xs);\n letter-spacing: 0.08em;\n}\n\n.wx-review-row__job {\n overflow: hidden;\n color: var(--wx-text-muted);\n font-size: var(--wx-font-size-sm);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.wx-review-row__facts {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--wx-space-4);\n min-width: 0;\n margin-top: var(--wx-space-2);\n}\n\n.wx-review-row__facts:empty {\n display: none;\n}\n\n.wx-review-row__locales {\n color: var(--wx-text-muted);\n font-family: var(--wx-font-family-mono);\n font-size: var(--wx-font-size-xs);\n text-transform: uppercase;\n}\n</style>\n","import { categoryRoutes, type AdminModule, type CategoriesOptions } from '@webx-ui/module-admin'\nimport ReviewsPage from './ReviewsPage.vue'\n\nexport interface ReviewsOptions {\n /** Where the reviews live inside the panel. The categories sit under it. */\n path?: string\n}\n\n/**\n * The categories of the reviews as the panel's shared category screens see them. Exported so\n * that a panel mounting the screens somewhere of its own does not have to repeat the words.\n *\n * No words about addresses: a category here has none (decision 5) — it is a button of the filter\n * on the site, and the shared list leaves the address line out when the server says so.\n */\nexport function reviewCategoriesOptions(path = '/reviews'): CategoriesOptions {\n return {\n api: 'reviews/categories',\n path: `${path}/categories`,\n name: 'webx.reviews.categories',\n module: 'review-categories',\n screen: 'reviews.category-form',\n manage: 'reviews.categories.manage',\n count: 'reviews_count',\n // The list narrowed to one category is also where its own order is dragged.\n items: (id) => ({ path, query: { category: String(id) } }),\n words: {\n new: 'webx-reviews::category.new',\n empty: 'webx-reviews::category.empty',\n 'empty-help': 'webx-reviews::category.empty-help',\n order: 'webx-reviews::category.order',\n hidden: 'webx-reviews::category.hidden',\n count: 'webx-reviews::category.reviews',\n 'show-items': 'webx-reviews::category.show-reviews',\n 'delete-blocked': 'webx-reviews::category.delete-blocked',\n 'delete-text': 'webx-reviews::category.delete-text',\n deleted: 'webx-reviews::category.deleted',\n saved: 'webx-reviews::category.saved',\n 'field-title': 'webx-reviews::category.field-title',\n },\n }\n}\n\n/**\n * The reviews as sections of the panel: reviews, and their categories (§4.6).\n *\n * Two modules rather than one, because the navigation is one entry per module; the server puts\n * both in the `reviews` group, which is what draws them under one heading. A section whose server\n * half is not installed never appears — the entry is built from the manifest.\n */\nexport function reviews(options: ReviewsOptions = {}): AdminModule[] {\n const path = options.path ?? '/reviews'\n\n return [\n {\n id: 'reviews',\n path,\n // One route: the open review is in the address (`?review=`), beside the list it was opened\n // from, so a link to it is a link to both.\n routes: [{ path, name: 'webx.reviews', component: ReviewsPage, props: { base: path } }],\n },\n {\n id: 'review-categories',\n path: `${path}/categories`,\n routes: categoryRoutes(reviewCategoriesOptions(path)),\n },\n ]\n}\n"],"names":["REVIEWS_API","createReviewsApi","admin","base","data","body","query","search","id","values","ids","category","reorderItems","reviewsMessages","seeded","useReviewsMessages","i18n","useAdmin","props","__props","emit","__emit","context","api","locales","useLocales","t","useTranslate","message","useErrorText","review","ref","snapshot","loading","saving","errors","canManage","computed","current","dirty","state","title","written","fallback","localizedValue","take","detail","blank","load","error","toast","save","made","remove","record","confirm","leaveGuard","event","onKeydown","onMounted","onBeforeUnmount","mayLeave","onBeforeRouteUpdate","to","from","onBeforeRouteLeave","actions","_createElementBlock","_createBlock","_unref","WxSkeleton","_Fragment","_createVNode","WxScreenHead","WxBadge","WxScreen","$event","WxActionBar","WxSaveState","WxButton","route","useRoute","router","useRouter","rows","categories","module","view","value","inBin","raw","q","typed","selected","open","close","views","order","useItemOrder","sortable","emptyText","answer","watch","pause","narrow","choose","created","reorder","row","actionsFor","restore","removed","unseen","stars","rating","whole","WxListScreen","WxCard","WxListDetail","_createElementVNode","_hoisted_1","WxInput","WxIcon","WxSelect","item","_normalizeClass","_createTextVNode","WxEmpty","WxSortableList","_withCtx","_openBlock","_resolveDynamicComponent","WxAvatar","_hoisted_2","_hoisted_3","_hoisted_4","_toDisplayString","_hoisted_5","_hoisted_6","_hoisted_7","WxTooltip","_renderList","chip","_hoisted_8","WxRowMenu","WxAlert","inline","back","ReviewPane","reviewCategoriesOptions","path","reviews","options","ReviewsPage","categoryRoutes"],"mappings":";;;;AAsBO,MAAMA,IAAc;AAMpB,SAASC,GAAiBC,GAAiC;AAChE,QAAMC,IAAO,GAAGD,EAAM,OAAO,IAAIF,CAAW,IACtCI,IAAO,CAAIC,MAAyBA,EAAK;AAE/C,SAAO;AAAA,IACL,MAAM,CAACC,IAAQ,OAAO;AACpB,YAAMC,IAAS,IAAI,gBAAA;AAGnB,aAAID,EAAM,UAAQC,EAAO,IAAI,UAAUD,EAAM,MAAM,GAC/CA,EAAM,YAAY,QAAMC,EAAO,IAAI,YAAY,OAAOD,EAAM,QAAQ,CAAC,GACrEA,EAAM,WAASC,EAAO,IAAI,WAAW,GAAG,GAErCL,EAAM,KAAK,IAAiBK,EAAO,OAAO,IAAI,GAAGJ,CAAI,IAAII,CAAM,KAAKJ,CAAI;AAAA,IACjF;AAAA,IACA,KAAK,CAACK,MAAON,EAAM,KAAK,IAA4B,GAAGC,CAAI,IAAIK,CAAE,EAAE,EAAE,KAAKJ,CAAI;AAAA,IAC9E,QAAQ,CAACK,MAAWP,EAAM,KAAK,KAA6BC,GAAM,EAAE,QAAAM,EAAA,CAAQ,EAAE,KAAKL,CAAI;AAAA,IACvF,MAAM,CAACI,GAAIC,MACTP,EAAM,KAAK,IAA4B,GAAGC,CAAI,IAAIK,CAAE,IAAI,EAAE,QAAAC,GAAQ,EAAE,KAAKL,CAAI;AAAA,IAC/E,QAAQ,CAACI,MAAON,EAAM,KAAK,OAAa,GAAGC,CAAI,IAAIK,CAAE,EAAE,EAAE,KAAK,MAAA;AAAA,KAAe;AAAA;AA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AAAA,MACJ,MAAM,GAAGA,CAAI;AAAA,MACb,QAAQI,GAAeL,GAAwBC,CAAI,CAAC;AAAA,IAAA;AAAA,EACtD;AAEJ;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Messages } from '@webx-ui/module-admin';
|
|
2
|
+
/**
|
|
3
|
+
* The English this package speaks on its own, before the server's dictionary arrives, or without
|
|
4
|
+
* one. The server ships the same lines in ten languages under `webx-reviews::` and overrides
|
|
5
|
+
* these; `messages.test.ts` keeps the two sets of keys equal.
|
|
6
|
+
*/
|
|
7
|
+
export declare const reviewsMessages: Record<string, Messages>;
|
package/dist/module.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AdminModule, CategoriesOptions } from '@webx-ui/module-admin';
|
|
2
|
+
export interface ReviewsOptions {
|
|
3
|
+
/** Where the reviews live inside the panel. The categories sit under it. */
|
|
4
|
+
path?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The categories of the reviews as the panel's shared category screens see them. Exported so
|
|
8
|
+
* that a panel mounting the screens somewhere of its own does not have to repeat the words.
|
|
9
|
+
*
|
|
10
|
+
* No words about addresses: a category here has none (decision 5) — it is a button of the filter
|
|
11
|
+
* on the site, and the shared list leaves the address line out when the server says so.
|
|
12
|
+
*/
|
|
13
|
+
export declare function reviewCategoriesOptions(path?: string): CategoriesOptions;
|
|
14
|
+
/**
|
|
15
|
+
* The reviews as sections of the panel: reviews, and their categories (§4.6).
|
|
16
|
+
*
|
|
17
|
+
* Two modules rather than one, because the navigation is one entry per module; the server puts
|
|
18
|
+
* both in the `reviews` group, which is what draws them under one heading. A section whose server
|
|
19
|
+
* half is not installed never appears — the entry is built from the manifest.
|
|
20
|
+
*/
|
|
21
|
+
export declare function reviews(options?: ReviewsOptions): AdminModule[];
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.wx-review[data-v-d5d4af03]{display:flex;flex-direction:column;gap:var(--wx-gap, var(--wx-space-16));min-width:0;padding:var(--wx-gap, var(--wx-space-16));container-type:inline-size}.wx-review__ghost[data-v-d5d4af03]{max-width:480px}.wx-reviews>.wx-card__body{display:flex;flex-direction:column;overflow:clip;border-radius:inherit}.wx-reviews__bar[data-v-572ff29d]{display:flex;flex-wrap:wrap;gap:var(--wx-space-8);padding:var(--wx-space-12) var(--wx-space-12) var(--wx-space-8)}.wx-reviews__search[data-v-572ff29d]{flex:1 1 180px;min-width:0}.wx-reviews__bar[data-v-572ff29d]>.wx-select{flex:1 1 140px;min-width:0}.wx-reviews__new[data-v-572ff29d]{display:flex;align-items:center;gap:var(--wx-space-8);width:calc(100% - 2 * var(--wx-space-8));margin:0 var(--wx-space-8) var(--wx-space-4);padding:var(--wx-space-8);border:1px dashed var(--wx-border-default);border-radius:var(--wx-radius-sm);background:none;font:inherit;color:var(--wx-color-primary);text-align:start;cursor:pointer}.wx-reviews__new[data-v-572ff29d]:hover,.wx-reviews__new.is-current[data-v-572ff29d]{background:var(--wx-bg-subtle)}.wx-reviews__loading[data-v-572ff29d]{padding:var(--wx-space-12)}.wx-reviews__list[data-v-572ff29d]{padding-inline:var(--wx-space-8)}.wx-reviews__list.is-loading[data-v-572ff29d]{opacity:.6}.wx-reviews__list[data-v-572ff29d] .wx-sortable-list__row{gap:var(--wx-space-4);padding-inline:var(--wx-space-4);border-radius:var(--wx-radius-sm)}.wx-reviews__list[data-v-572ff29d] .wx-sortable-list__row:hover,.wx-reviews__list[data-v-572ff29d] .wx-sortable-list__row:has(.is-current){background:var(--wx-bg-subtle)}.wx-reviews__note[data-v-572ff29d]{margin:var(--wx-space-8)}.wx-review-row[data-v-572ff29d]{display:flex;align-items:flex-start;gap:var(--wx-space-10);flex:1 1 auto;width:100%;min-width:0;padding-block:var(--wx-space-8);padding-inline:0;border:0;background:none;font:inherit;color:inherit;text-align:start}button.wx-review-row[data-v-572ff29d]{cursor:pointer}.wx-review-row__photo[data-v-572ff29d]{flex:none}.wx-review-row__body[data-v-572ff29d]{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--wx-space-2);min-width:0}.wx-review-row__who[data-v-572ff29d]{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:var(--wx-space-8);min-width:0}.wx-review-row__name[data-v-572ff29d]{min-width:0;overflow:hidden;font-weight:var(--wx-font-weight-medium);text-overflow:ellipsis;white-space:nowrap}.wx-review-row.is-current .wx-review-row__name[data-v-572ff29d]{color:var(--wx-color-primary)}.wx-review-row__stars[data-v-572ff29d]{flex:none;color:var(--wx-color-warning);font-size:var(--wx-font-size-xs);letter-spacing:.08em}.wx-review-row__job[data-v-572ff29d]{overflow:hidden;color:var(--wx-text-muted);font-size:var(--wx-font-size-sm);text-overflow:ellipsis;white-space:nowrap}.wx-review-row__facts[data-v-572ff29d]{display:flex;flex-wrap:wrap;align-items:center;gap:var(--wx-space-4);min-width:0;margin-top:var(--wx-space-2)}.wx-review-row__facts[data-v-572ff29d]:empty{display:none}.wx-review-row__locales[data-v-572ff29d]{color:var(--wx-text-muted);font-family:var(--wx-font-family-mono);font-size:var(--wx-font-size-xs);text-transform:uppercase}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ScreenModel } from '@webx-ui/schema';
|
|
2
|
+
/** A category as a row of the list names one: the filter, and the chips on the row. */
|
|
3
|
+
export interface ReviewCategoryRef {
|
|
4
|
+
id: number;
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* One review as the section lists it (`ReviewResource`, §4.7).
|
|
9
|
+
*
|
|
10
|
+
* `locales` is where it can be seen — the languages it has a text in — and it is a separate
|
|
11
|
+
* thing from `published` on purpose: "published, and seen nowhere" is the row the list has to
|
|
12
|
+
* point out.
|
|
13
|
+
*/
|
|
14
|
+
export interface ReviewRow {
|
|
15
|
+
id: number;
|
|
16
|
+
/**
|
|
17
|
+
* In the language the panel is open in, in the default one where there is none, `#id` where
|
|
18
|
+
* neither — a person's name is usually the same in every language (decision 7).
|
|
19
|
+
*/
|
|
20
|
+
name: string;
|
|
21
|
+
/** The same way; `''` or `null` when nobody wrote one. */
|
|
22
|
+
job_title: string | null;
|
|
23
|
+
/** 1…5, or nothing: a review without stars is a review. */
|
|
24
|
+
rating: number | null;
|
|
25
|
+
photo: {
|
|
26
|
+
thumb: string | null;
|
|
27
|
+
} | null;
|
|
28
|
+
published: boolean;
|
|
29
|
+
/** Its place in the whole list. */
|
|
30
|
+
position: number;
|
|
31
|
+
locales: string[];
|
|
32
|
+
categories: ReviewCategoryRef[];
|
|
33
|
+
updated_at: string | null;
|
|
34
|
+
deleted_at: string | null;
|
|
35
|
+
}
|
|
36
|
+
/** Every review — no pages: the list is where reviews are put in order (§4.6). */
|
|
37
|
+
export interface ReviewsList {
|
|
38
|
+
data: ReviewRow[];
|
|
39
|
+
filters: {
|
|
40
|
+
categories: ReviewCategoryRef[];
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface ReviewQuery {
|
|
44
|
+
/** The name, the job title or the text, in any language the site has. */
|
|
45
|
+
search?: string;
|
|
46
|
+
/** One category: the list comes in its own order, and a drag writes that order. */
|
|
47
|
+
category?: number | null;
|
|
48
|
+
/** What was deleted. The only way back to a review in the bin is through this list. */
|
|
49
|
+
trashed?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** The record half of the form's answer — what the head of the form needs. */
|
|
52
|
+
export interface ReviewSummary {
|
|
53
|
+
id: number;
|
|
54
|
+
name: string;
|
|
55
|
+
published: boolean;
|
|
56
|
+
deleted_at: string | null;
|
|
57
|
+
}
|
|
58
|
+
/** One review as its form opens it: the record, and the values of `reviews.form` by field name. */
|
|
59
|
+
export interface ReviewDetail {
|
|
60
|
+
review: ReviewSummary;
|
|
61
|
+
values: ScreenModel;
|
|
62
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webx-ui/module-reviews",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Reviews for the WebX UI admin panel: photo, name, job title, rating and text, in flat categories, ordered by hand, shown on the site by a block.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"*.css"
|
|
9
|
+
],
|
|
10
|
+
"keywords": [
|
|
11
|
+
"webx-ui",
|
|
12
|
+
"vue",
|
|
13
|
+
"admin",
|
|
14
|
+
"cms",
|
|
15
|
+
"reviews",
|
|
16
|
+
"testimonials"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/webx-ui/webx-ui.git",
|
|
21
|
+
"directory": "packages/module-reviews"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://webx-ui.github.io/webx-ui/guide/reviews.html",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"module": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./style.css": "./dist/style.css",
|
|
39
|
+
"./dist/style.css": "./dist/style.css",
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"vue": "^3.5.0",
|
|
44
|
+
"vue-router": "^4.5.0"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@webx-ui/core": "^0.33.2",
|
|
48
|
+
"@webx-ui/module-admin": "^0.17.0",
|
|
49
|
+
"@webx-ui/schema": "^0.6.1"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^24.10.1",
|
|
53
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
54
|
+
"typescript": "^5.9.3",
|
|
55
|
+
"vite": "^7.1.14",
|
|
56
|
+
"vite-plugin-dts": "^4.5.4",
|
|
57
|
+
"vue": "^3.5.24",
|
|
58
|
+
"vue-router": "^4.5.1",
|
|
59
|
+
"vue-tsc": "^3.1.3"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "vite build",
|
|
63
|
+
"dev": "vite build --watch",
|
|
64
|
+
"typecheck": "vue-tsc -p tsconfig.json --noEmit"
|
|
65
|
+
}
|
|
66
|
+
}
|