@sharadox/sharadox-web-library 0.43.0 → 0.44.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.
Files changed (55) hide show
  1. package/README.md +1 -1
  2. package/distribution/component/about/feed/activity/index.d.ts +8 -0
  3. package/distribution/component/about/feed/activity/index.d.ts.map +1 -0
  4. package/distribution/component/about/feed/activity/index.js +23 -0
  5. package/distribution/component/about/feed/activity/index.js.map +1 -0
  6. package/distribution/component/about/feed/activity/index.module.css +1 -0
  7. package/distribution/component/about/feed/activity/index.module.scss +91 -0
  8. package/distribution/component/about/feed/activity/type.d.ts +7 -0
  9. package/distribution/component/about/feed/activity/type.d.ts.map +1 -0
  10. package/distribution/component/about/feed/activity/type.js +2 -0
  11. package/distribution/component/about/feed/activity/type.js.map +1 -0
  12. package/distribution/component/about/feed/client/index.d.ts +7 -0
  13. package/distribution/component/about/feed/client/index.d.ts.map +1 -0
  14. package/distribution/component/about/feed/client/index.js +18 -0
  15. package/distribution/component/about/feed/client/index.js.map +1 -0
  16. package/distribution/component/about/feed/client/index.module.css +1 -0
  17. package/distribution/component/about/feed/client/index.module.scss +183 -0
  18. package/distribution/component/about/feed/client/type.d.ts +5 -0
  19. package/distribution/component/about/feed/client/type.d.ts.map +1 -0
  20. package/distribution/component/about/feed/client/type.js +2 -0
  21. package/distribution/component/about/feed/client/type.js.map +1 -0
  22. package/distribution/component/about/feed/euros/index.d.ts +4 -0
  23. package/distribution/component/about/feed/euros/index.d.ts.map +1 -0
  24. package/distribution/component/about/feed/euros/index.js +7 -0
  25. package/distribution/component/about/feed/euros/index.js.map +1 -0
  26. package/distribution/component/about/feed/index.d.ts +5 -10
  27. package/distribution/component/about/feed/index.d.ts.map +1 -1
  28. package/distribution/component/about/feed/index.js +98 -21
  29. package/distribution/component/about/feed/index.js.map +1 -1
  30. package/distribution/component/about/feed/index.module.css +1 -1
  31. package/distribution/component/about/feed/index.module.scss +81 -340
  32. package/distribution/component/about/feed/project/index.d.ts +7 -0
  33. package/distribution/component/about/feed/project/index.d.ts.map +1 -0
  34. package/distribution/component/about/feed/project/index.js +18 -0
  35. package/distribution/component/about/feed/project/index.js.map +1 -0
  36. package/distribution/component/about/feed/project/index.module.css +1 -0
  37. package/distribution/component/about/feed/project/index.module.scss +129 -0
  38. package/distribution/component/about/feed/project/type.d.ts +7 -0
  39. package/distribution/component/about/feed/project/type.d.ts.map +1 -0
  40. package/distribution/component/about/feed/project/type.js +2 -0
  41. package/distribution/component/about/feed/project/type.js.map +1 -0
  42. package/distribution/component/about/feed/script/index.d.ts +14 -0
  43. package/distribution/component/about/feed/script/index.d.ts.map +1 -0
  44. package/distribution/component/about/feed/script/index.js +60 -0
  45. package/distribution/component/about/feed/script/index.js.map +1 -0
  46. package/distribution/component/about/feed/script/type.d.ts +16 -0
  47. package/distribution/component/about/feed/script/type.d.ts.map +1 -0
  48. package/distribution/component/about/feed/script/type.js +2 -0
  49. package/distribution/component/about/feed/script/type.js.map +1 -0
  50. package/distribution/content/about/index.d.ts +144 -79
  51. package/distribution/content/about/index.d.ts.map +1 -1
  52. package/distribution/content/about/index.js +95 -43
  53. package/distribution/content/about/index.js.map +1 -1
  54. package/llms.txt +2 -1
  55. package/package.json +2 -2
package/README.md CHANGED
@@ -34,7 +34,7 @@ Everything generic comes from the open-source Sharadox libraries, configured her
34
34
  - **One source for shared copy:** text used in more than one place lives in its own content module and is imported, never retyped.
35
35
  - **`component/`:** the page's branded parts:
36
36
  - grid frame, `Cross` marks, navigation (below 1100px its links open in a menu under the bar, in the bar's frosted background, scrolling when it doesn't fit, as on a phone held sideways) and footer (the brand with Start a Project, the services, the studio, the language and style; with Back to top under the style switch; then a centered row of everything legal: the copyright, the dispute notice, the links)
37
- - hero and its guides (on wide screens a little shorter than the screen, so the service index shows at its bottom; the copy in the middle of the space under the bar, the globe centered on it), service index, `About` (a sentence lighting up as it scrolls, then the brand online beside the platform that runs the business, whose live panel takes turns showing its activity, a project and a client), and Services: four groups of cards (Web, Desktop & Mobile, Creative, Marketing), each card with its own animated 3D object (`service-object`, in CSS 3D, turning towards the pointer), a description and a button that starts that project; rows of three, with a row of two (or two rows of two) when the count needs it; `ServiceUnlisted`, the invitation for ideas none of them name, is a section of its own placed after the capabilities; `Portfolio` (each project live on a computer and a phone scrolling through its pages, beside its story, details and chips of the services we made for it; filters by service, client and year, and four orders; screens from the site's `public/portfolio/<key>/`)
37
+ - hero and its guides (on wide screens a little shorter than the screen, so the service index shows at its bottom; the copy in the middle of the space under the bar, the globe centered on it), service index, `About` (a sentence lighting up as it scrolls, then the brand online beside the platform that runs the business, whose live panel, once in view, has a pointer click through its activity log, a project (ticking a task) and a client (charts), reading details as it goes), and Services: four groups of cards (Web, Desktop & Mobile, Creative, Marketing), each card with its own animated 3D object (`service-object`, in CSS 3D, turning towards the pointer), a description and a button that starts that project; rows of three, with a row of two (or two rows of two) when the count needs it; `ServiceUnlisted`, the invitation for ideas none of them name, is a section of its own placed after the capabilities; `Portfolio` (each project live on a computer and a phone scrolling through its pages, beside its story, details and chips of the services we made for it; filters by service, client and year, and four orders; screens from the site's `public/portfolio/<key>/`)
38
38
  - capabilities sheet (headed by the same `ServiceShortcut`s as under the hero, which stay in view under the bar, and shorter columns run on in empty ruled cells; with what's always included under it), `Faq` (questions that open to their answers, native `details`, with their FAQPage structured data), process (each dot lights as the line reaches it, measured by `process/measure-stops`), contact (the invitation and the direct email over a wide form: the visitor's details, the message and Send on the left, the choices on the right), section indicator (in the margin right of the frame: the rail along the line, ticks and numbers out from it, names to the right, ending at the window's edge when there isn't room; nothing shifts when the section changes; ticks only where the margin is narrow), style switch
39
39
  - `Consent`, the Sharadox cookie panel (reopened by the footer's Cookie Preferences), and the footer's legal parts: Portugal's complaints book and the Algarve's consumer dispute notice (CIMAAL)
40
40
  - the Sharadox wrapper around the shared globe, structured data, share image, `renderSocialImage()` (images to post on social media: the mark on black, landscape and portrait, alone or with the hero's three lines; the application serves them at `/<locale>/social/<name>`), `llmsText()` for `/llms.txt`
@@ -0,0 +1,8 @@
1
+ import type { ActivityProperties } from "@sharadox/sharadox-web-library/component/about/feed/activity/type";
2
+ /**
3
+ * The activity log: entries arrive at the top one by one and push the others down. Each shows what happened as a
4
+ * picture (approved, paid, ordered, delivered, installed) beside the words, and who did it: their initials, or a bolt
5
+ * for what the platform did on its own.
6
+ */
7
+ export declare function Activity({ locale, shown }: ActivityProperties): import("react").JSX.Element;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../source/component/about/feed/activity/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mEAAmE,CAAC;AAY5G;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,kBAAkB,+BA2C7D"}
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AnimatePresence, motion } from "motion/react";
3
+ import { Icon } from "@sharadox/icon-web-library/icon";
4
+ import { translate } from "@sharadox/internationalization-web-library/translate";
5
+ import { ABOUT } from "@sharadox/sharadox-web-library/content/about";
6
+ import styles from "./index.module.css";
7
+ const { feed } = ABOUT.business;
8
+ const EASE = [0.22, 1, 0.36, 1];
9
+ /** A person's initials: "Ana Sousa" is "AS", "Rui" is "R". */
10
+ const initials = (name) => name
11
+ .split(" ")
12
+ .map((word) => word[0])
13
+ .join("");
14
+ /**
15
+ * The activity log: entries arrive at the top one by one and push the others down. Each shows what happened as a
16
+ * picture (approved, paid, ordered, delivered, installed) beside the words, and who did it: their initials, or a bolt
17
+ * for what the platform did on its own.
18
+ */
19
+ export function Activity({ locale, shown }) {
20
+ const entries = feed.events.slice(0, shown).map((event, index) => ({ event, index }));
21
+ return (_jsx("ol", { className: styles.log, children: _jsx(AnimatePresence, { initial: false, children: entries.reverse().map(({ event, index }) => (_jsxs(motion.li, { layout: true, "data-target": `event-${index}`, "data-kind": event.icon, initial: { opacity: 0, y: -14, scale: 0.97 }, animate: { opacity: 1, y: 0, scale: 1 }, exit: { opacity: 0 }, transition: { duration: 0.5, ease: EASE }, children: [_jsx("span", { className: styles.picture, children: _jsx(Icon, { name: event.icon }) }), _jsxs("span", { className: styles.words, children: [_jsx("span", { children: event[locale] }), _jsx("span", { className: styles.who, children: "by" in event ? (_jsxs(_Fragment, { children: [_jsx("i", { className: styles.avatar, children: initials(event.by) }), event.by] })) : (_jsxs(_Fragment, { children: [_jsx("i", { className: styles.automatic, children: _jsx(Icon, { name: "bolt" }) }), translate(feed.automatic, locale)] })) })] }), _jsx("time", { className: "monospace", children: event.time })] }, event.en))) }) }));
22
+ }
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../source/component/about/feed/activity/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sDAAsD,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,8CAA8C,CAAC;AACrE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAGzC,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC;AAChC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAU,CAAC;AAEzC,8DAA8D;AAC9D,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAChC,IAAI;KACD,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACtB,IAAI,CAAC,EAAE,CAAC,CAAC;AAEd;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAsB;IAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACtF,OAAO,CACL,aAAI,SAAS,EAAE,MAAM,CAAC,GAAG,YACvB,KAAC,eAAe,IAAC,OAAO,EAAE,KAAK,YAC5B,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAC3C,MAAC,MAAM,CAAC,EAAE,IAER,MAAM,uBACO,SAAS,KAAK,EAAE,eAClB,KAAK,CAAC,IAAI,EACrB,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAC5C,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EACvC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EACpB,UAAU,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,aAEzC,eAAM,SAAS,EAAE,MAAM,CAAC,OAAO,YAC7B,KAAC,IAAI,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,GAAI,GACrB,EACP,gBAAM,SAAS,EAAE,MAAM,CAAC,KAAK,aAC3B,yBAAO,KAAK,CAAC,MAAM,CAAC,GAAQ,EAC5B,eAAM,SAAS,EAAE,MAAM,CAAC,GAAG,YACxB,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CACf,8BACE,YAAG,SAAS,EAAE,MAAM,CAAC,MAAM,YAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,GAAK,EACpD,KAAK,CAAC,EAAE,IACR,CACJ,CAAC,CAAC,CAAC,CACF,8BACE,YAAG,SAAS,EAAE,MAAM,CAAC,SAAS,YAC5B,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,GAClB,EACH,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,IACjC,CACJ,GACI,IACF,EACP,eAAM,SAAS,EAAC,WAAW,YAAE,KAAK,CAAC,IAAI,GAAQ,KA9B1C,KAAK,CAAC,EAAE,CA+BH,CACb,CAAC,GACc,GACf,CACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ .log{display:grid;justify-content:stretch;align-content:start;gap:8px;margin:0;padding:0;list-style:none}.log li{display:grid;grid-template-columns:auto minmax(0, 1fr) auto;align-items:center;gap:12px;padding:9px 12px 9px 9px;border:1px solid var(--line-2);border-radius:12px;background:color-mix(in srgb, var(--foreground) 10%, var(--background));text-align:left}.log time{align-self:start;padding-top:2px;font-size:11px;color:var(--foreground-3)}.picture{display:grid;place-items:center;width:36px;height:36px;border:1px solid var(--line-2);border-radius:10px;background:color-mix(in srgb, var(--foreground) 16%, var(--background));font-size:18px}li[data-kind=euro] .picture{border-color:var(--foreground);background:var(--foreground);color:var(--background)}.words{display:grid;justify-content:stretch;gap:3px;font-size:13.5px;line-height:1.3}.who{display:flex;align-items:center;justify-content:flex-start;gap:6px;font-size:11.5px;color:var(--foreground-3)}.avatar,.automatic{display:grid;place-items:center;width:18px;height:18px;border-radius:50%;font-size:8.5px;font-style:normal;font-weight:600;letter-spacing:.02em}.avatar{background:var(--foreground);color:var(--background)}.automatic{border:1px solid var(--line-2);font-size:11px;color:var(--foreground-2)}@container (max-width: 300px){.log li{grid-template-columns:auto minmax(0, 1fr)}.log li time{grid-column:2;padding-top:0}}
@@ -0,0 +1,91 @@
1
+ @use "style/token" as *;
2
+ @use "style/object" as *;
3
+
4
+ .log {
5
+ display: grid;
6
+ justify-content: stretch;
7
+ align-content: start;
8
+ gap: 8px;
9
+ margin: 0;
10
+ padding: 0;
11
+ list-style: none;
12
+ li {
13
+ display: grid;
14
+ grid-template-columns: auto minmax(0, 1fr) auto;
15
+ align-items: center;
16
+ gap: 12px;
17
+ padding: 9px 12px 9px 9px;
18
+ border: 1px solid var(--line-2);
19
+ border-radius: 12px;
20
+ background: surface($hint);
21
+ text-align: left;
22
+ }
23
+ time {
24
+ align-self: start;
25
+ padding-top: 2px;
26
+ font-size: 11px;
27
+ color: var(--foreground-3);
28
+ }
29
+ }
30
+ /* What happened, as a picture: a tile with the action's icon; payments are solid, so money stands out. */
31
+ .picture {
32
+ display: grid;
33
+ place-items: center;
34
+ width: 36px;
35
+ height: 36px;
36
+ border: 1px solid var(--line-2);
37
+ border-radius: 10px;
38
+ background: surface($raised);
39
+ font-size: 18px;
40
+ li[data-kind="euro"] & {
41
+ border-color: var(--foreground);
42
+ background: var(--foreground);
43
+ color: var(--background);
44
+ }
45
+ }
46
+ .words {
47
+ display: grid;
48
+ justify-content: stretch;
49
+ gap: 3px;
50
+ font-size: 13.5px;
51
+ line-height: 1.3;
52
+ }
53
+ .who {
54
+ display: flex;
55
+ align-items: center;
56
+ justify-content: flex-start;
57
+ gap: 6px;
58
+ font-size: 11.5px;
59
+ color: var(--foreground-3);
60
+ }
61
+ .avatar,
62
+ .automatic {
63
+ display: grid;
64
+ place-items: center;
65
+ width: 18px;
66
+ height: 18px;
67
+ border-radius: 50%;
68
+ font-size: 8.5px;
69
+ font-style: normal;
70
+ font-weight: 600;
71
+ letter-spacing: 0.02em;
72
+ }
73
+ .avatar {
74
+ background: var(--foreground);
75
+ color: var(--background);
76
+ }
77
+ .automatic {
78
+ border: 1px solid var(--line-2);
79
+ font-size: 11px;
80
+ color: var(--foreground-2);
81
+ }
82
+ /* In a narrow panel the time goes under the words, so the words keep their room. */
83
+ @container (max-width: 300px) {
84
+ .log li {
85
+ grid-template-columns: auto minmax(0, 1fr);
86
+ time {
87
+ grid-column: 2;
88
+ padding-top: 0;
89
+ }
90
+ }
91
+ }
@@ -0,0 +1,7 @@
1
+ import type { Locale } from "@sharadox/sharadox-web-library/content/locale/type";
2
+ export interface ActivityProperties {
3
+ locale: Locale;
4
+ /** How many entries have come in, oldest first; the newest shows at the top. */
5
+ shown: number;
6
+ }
7
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../../../source/component/about/feed/activity/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oDAAoD,CAAC;AAEjF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../../../source/component/about/feed/activity/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { ClientProperties } from "@sharadox/sharadox-web-library/component/about/feed/client/type";
2
+ /**
3
+ * One client, at a glance: a ring of what she has paid of everything quoted, a bar per project sized by its amount,
4
+ * and her tasks, done against still to do.
5
+ */
6
+ export declare function Client({ locale }: ClientProperties): import("react").JSX.Element;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../source/component/about/feed/client/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iEAAiE,CAAC;AAIxG;;;GAGG;AACH,wBAAgB,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,gBAAgB,+BA4DlD"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { translate } from "@sharadox/internationalization-web-library/translate";
3
+ import { euros } from "@sharadox/sharadox-web-library/component/about/feed/euros";
4
+ import { ABOUT } from "@sharadox/sharadox-web-library/content/about";
5
+ import styles from "./index.module.css";
6
+ const { client } = ABOUT.business.feed;
7
+ /**
8
+ * One client, at a glance: a ring of what she has paid of everything quoted, a bar per project sized by its amount,
9
+ * and her tasks, done against still to do.
10
+ */
11
+ export function Client({ locale }) {
12
+ const paid = Math.round((client.paid / client.quoted) * 100);
13
+ const largest = Math.max(...client.projects.map((project) => project.amount));
14
+ const done = client.tasks.done;
15
+ const left = client.tasks.total - done;
16
+ return (_jsxs("div", { className: styles.client, children: [_jsxs("div", { className: styles.title, children: [_jsx("span", { className: styles.avatar, children: client.initials }), _jsxs("span", { children: [_jsx("b", { children: client.name }), _jsx("small", { children: translate(client.since, locale) })] })] }), _jsxs("div", { className: styles.money, children: [_jsxs("div", { className: styles.ring, "data-target": "donut", children: [_jsxs("svg", { viewBox: "0 0 80 80", children: [_jsx("circle", { cx: "40", cy: "40", r: "32", pathLength: "100" }), _jsx("circle", { cx: "40", cy: "40", r: "32", pathLength: "100", strokeDasharray: `${paid} 100` })] }), _jsxs("b", { children: [paid, "%"] })] }), _jsxs("dl", { children: [_jsxs("div", { children: [_jsxs("dt", { children: [_jsx("i", { "data-paid": true }), translate(client.paidLabel, locale)] }), _jsx("dd", { children: euros(client.paid, locale) })] }), _jsxs("div", { children: [_jsxs("dt", { children: [_jsx("i", {}), translate(client.quotedLabel, locale)] }), _jsx("dd", { children: euros(client.quoted, locale) })] })] })] }), _jsxs("div", { className: styles.projects, children: [_jsx("span", { className: `monospace ${styles.label}`, children: translate(client.projectsLabel, locale) }), client.projects.map((project, index) => (_jsxs("div", { className: styles.bar, "data-target": `project-${index}`, children: [_jsxs("span", { children: [project[locale], " ", _jsx("small", { children: project.year })] }), _jsx("i", { style: { "--to": `${(project.amount / largest) * 100}%` } }), _jsx("b", { children: euros(project.amount, locale) })] }, project.en)))] }), _jsxs("div", { className: styles.tasks, "data-target": "tasks", children: [_jsx("span", { className: `monospace ${styles.label}`, children: translate(client.tasksLabel, locale) }), _jsx("i", { style: { "--to": `${(done / client.tasks.total) * 100}%` } }), _jsxs("span", { children: [_jsx("b", { children: done }), " ", translate(client.doneLabel, locale), " \u00B7 ", _jsx("b", { children: left }), " ", translate(client.leftLabel, locale)] })] })] }));
17
+ }
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../source/component/about/feed/client/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sDAAsD,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,2DAA2D,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,8CAA8C,CAAC;AACrE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAGzC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;AAEvC;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,MAAM,EAAoB;IACjD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;IAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;IACvC,OAAO,CACL,eAAK,SAAS,EAAE,MAAM,CAAC,MAAM,aAC3B,eAAK,SAAS,EAAE,MAAM,CAAC,KAAK,aAC1B,eAAM,SAAS,EAAE,MAAM,CAAC,MAAM,YAAG,MAAM,CAAC,QAAQ,GAAQ,EACxD,2BACE,sBAAI,MAAM,CAAC,IAAI,GAAK,EACpB,0BAAQ,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAS,IAC3C,IACH,EACN,eAAK,SAAS,EAAE,MAAM,CAAC,KAAK,aAC1B,eAAK,SAAS,EAAE,MAAM,CAAC,IAAI,iBAAc,OAAO,aAC9C,eAAK,OAAO,EAAC,WAAW,aACtB,iBAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,GAAG,EAClD,iBAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,eAAe,EAAE,GAAG,IAAI,MAAM,GAAI,IAC9E,EACN,wBAAI,IAAI,SAAM,IACV,EACN,yBACE,0BACE,yBACE,gCAAe,EACd,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IACjC,EACL,uBAAK,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAM,IACjC,EACN,0BACE,yBACE,aAAK,EACJ,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,IACnC,EACL,uBAAK,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAM,IACnC,IACH,IACD,EACN,eAAK,SAAS,EAAE,MAAM,CAAC,QAAQ,aAC7B,eAAM,SAAS,EAAE,aAAa,MAAM,CAAC,KAAK,EAAE,YAAG,SAAS,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,GAAQ,EAC7F,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CACvC,eAAsB,SAAS,EAAE,MAAM,CAAC,GAAG,iBAAe,WAAW,KAAK,EAAE,aAC1E,2BACG,OAAO,CAAC,MAAM,CAAC,OAAE,0BAAQ,OAAO,CAAC,IAAI,GAAS,IAC1C,EACP,YAAG,KAAK,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,GAAG,EAAmB,GAAI,EACjF,sBAAI,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,GAAK,KAL9B,OAAO,CAAC,EAAE,CAMd,CACP,CAAC,IACE,EACN,eAAK,SAAS,EAAE,MAAM,CAAC,KAAK,iBAAc,OAAO,aAC/C,eAAM,SAAS,EAAE,aAAa,MAAM,CAAC,KAAK,EAAE,YAAG,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,GAAQ,EAC3F,YAAG,KAAK,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,EAAmB,GAAI,EAClF,2BACE,sBAAI,IAAI,GAAK,OAAE,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,cAAI,sBAAI,IAAI,GAAK,OAAE,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IACnG,IACH,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ .client{display:grid;justify-content:stretch;align-content:start;gap:16px;text-align:left}.title{display:flex;align-items:center;justify-content:flex-start;gap:12px}.title b{display:block;font-weight:600;letter-spacing:-0.02em}.title small{display:block;font-size:12px;color:var(--foreground-3)}.avatar{display:grid;place-items:center;flex:none;width:38px;height:38px;border-radius:50%;background:var(--foreground);color:var(--background);font-size:13px;font-weight:600}.money{display:grid;grid-template-columns:auto minmax(0, 1fr);align-items:center;gap:18px;padding:12px;border:1px solid var(--line-2);border-radius:12px;background:color-mix(in srgb, var(--foreground) 10%, var(--background))}.money dl{display:grid;justify-content:stretch;gap:8px;margin:0}.money dl>div{display:flex;align-items:center;justify-content:space-between;gap:10px}.money dt{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--foreground-2)}.money dt i{width:9px;height:9px;border-radius:3px;background:color-mix(in srgb, var(--foreground) 20%, transparent)}.money dt i[data-paid]{background:var(--foreground)}.money dd{margin:0;font-size:14px;font-weight:600}.ring{position:relative;display:grid;place-items:center;width:84px;height:84px}.ring svg{position:absolute;inset:0;transform:rotate(-90deg)}.ring circle{fill:none;stroke:color-mix(in srgb, var(--foreground) 20%, transparent);stroke-width:9}.ring circle:last-child{stroke:var(--foreground);stroke-linecap:round}.ring b{font-size:17px;font-weight:600;letter-spacing:-0.03em}.label{font-size:10.5px;letter-spacing:.04em;text-transform:uppercase;color:var(--foreground-3)}.projects{display:grid;justify-content:stretch;gap:8px}.bar{display:grid;grid-template-columns:112px minmax(0, 1fr) auto;align-items:center;gap:10px;font-size:13px}.bar small{margin-left:4px;font-size:11px;color:var(--foreground-3)}.bar i{height:8px;border-radius:99px;background:linear-gradient(var(--foreground), var(--foreground)) 0 0/var(--to) 100% no-repeat,color-mix(in srgb, var(--foreground) 10%, transparent)}.bar b{font-weight:600;font-size:12.5px}.tasks{display:grid;grid-template-columns:auto minmax(0, 1fr);align-items:center;gap:8px 12px}.tasks i{height:8px;border-radius:99px;background:linear-gradient(var(--foreground), var(--foreground)) 0 0/var(--to) 100% no-repeat,color-mix(in srgb, var(--foreground) 20%, transparent)}.tasks>span:last-child{grid-column:1/-1;font-size:12px;color:var(--foreground-3)}.tasks>span:last-child b{color:var(--foreground)}@container (max-width: 340px){.money{grid-template-columns:minmax(0, 1fr);justify-items:center}.money dl{width:100%}.bar{grid-template-columns:minmax(0, 1fr) auto;gap:4px 10px}.bar i{grid-column:1/-1;grid-row:2}}
@@ -0,0 +1,183 @@
1
+ @use "style/token" as *;
2
+ @use "style/object" as *;
3
+
4
+ .client {
5
+ display: grid;
6
+ justify-content: stretch;
7
+ align-content: start;
8
+ gap: 16px;
9
+ text-align: left;
10
+ }
11
+ .title {
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: flex-start;
15
+ gap: 12px;
16
+ b {
17
+ display: block;
18
+ font-weight: 600;
19
+ letter-spacing: -0.02em;
20
+ }
21
+ small {
22
+ display: block;
23
+ font-size: 12px;
24
+ color: var(--foreground-3);
25
+ }
26
+ }
27
+ .avatar {
28
+ display: grid;
29
+ place-items: center;
30
+ flex: none;
31
+ width: 38px;
32
+ height: 38px;
33
+ border-radius: 50%;
34
+ background: var(--foreground);
35
+ color: var(--background);
36
+ font-size: 13px;
37
+ font-weight: 600;
38
+ }
39
+ /* The ring of paid against quoted, its legend beside it. */
40
+ .money {
41
+ display: grid;
42
+ grid-template-columns: auto minmax(0, 1fr);
43
+ align-items: center;
44
+ gap: 18px;
45
+ padding: 12px;
46
+ border: 1px solid var(--line-2);
47
+ border-radius: 12px;
48
+ background: surface($hint);
49
+ dl {
50
+ display: grid;
51
+ justify-content: stretch;
52
+ gap: 8px;
53
+ margin: 0;
54
+ > div {
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: space-between;
58
+ gap: 10px;
59
+ }
60
+ }
61
+ dt {
62
+ display: flex;
63
+ align-items: center;
64
+ gap: 8px;
65
+ font-size: 12.5px;
66
+ color: var(--foreground-2);
67
+ i {
68
+ width: 9px;
69
+ height: 9px;
70
+ border-radius: 3px;
71
+ background: tint($faint);
72
+ &[data-paid] {
73
+ background: var(--foreground);
74
+ }
75
+ }
76
+ }
77
+ dd {
78
+ margin: 0;
79
+ font-size: 14px;
80
+ font-weight: 600;
81
+ }
82
+ }
83
+ .ring {
84
+ position: relative;
85
+ display: grid;
86
+ place-items: center;
87
+ width: 84px;
88
+ height: 84px;
89
+ svg {
90
+ position: absolute;
91
+ inset: 0;
92
+ transform: rotate(-90deg);
93
+ }
94
+ circle {
95
+ fill: none;
96
+ stroke: tint($faint);
97
+ stroke-width: 9;
98
+ &:last-child {
99
+ stroke: var(--foreground);
100
+ stroke-linecap: round;
101
+ }
102
+ }
103
+ b {
104
+ font-size: 17px;
105
+ font-weight: 600;
106
+ letter-spacing: -0.03em;
107
+ }
108
+ }
109
+ .label {
110
+ font-size: 10.5px;
111
+ letter-spacing: 0.04em;
112
+ text-transform: uppercase;
113
+ color: var(--foreground-3);
114
+ }
115
+ /* A bar per project: name and year, the bar sized by its amount, the amount. */
116
+ .projects {
117
+ display: grid;
118
+ justify-content: stretch;
119
+ gap: 8px;
120
+ }
121
+ .bar {
122
+ display: grid;
123
+ grid-template-columns: 112px minmax(0, 1fr) auto;
124
+ align-items: center;
125
+ gap: 10px;
126
+ font-size: 13px;
127
+ small {
128
+ margin-left: 4px;
129
+ font-size: 11px;
130
+ color: var(--foreground-3);
131
+ }
132
+ i {
133
+ height: 8px;
134
+ border-radius: 99px;
135
+ background:
136
+ linear-gradient(var(--foreground), var(--foreground)) 0 0 / var(--to) 100% no-repeat,
137
+ tint($hint);
138
+ }
139
+ b {
140
+ font-weight: 600;
141
+ font-size: 12.5px;
142
+ }
143
+ }
144
+ /* Tasks across her projects: one bar, done against to do. */
145
+ .tasks {
146
+ display: grid;
147
+ grid-template-columns: auto minmax(0, 1fr);
148
+ align-items: center;
149
+ gap: 8px 12px;
150
+ i {
151
+ height: 8px;
152
+ border-radius: 99px;
153
+ background:
154
+ linear-gradient(var(--foreground), var(--foreground)) 0 0 / var(--to) 100% no-repeat,
155
+ tint($faint);
156
+ }
157
+ > span:last-child {
158
+ grid-column: 1 / -1;
159
+ font-size: 12px;
160
+ color: var(--foreground-3);
161
+ b {
162
+ color: var(--foreground);
163
+ }
164
+ }
165
+ }
166
+ /* In a narrow panel: the ring over its legend, and each project's bar under its name and amount. */
167
+ @container (max-width: 340px) {
168
+ .money {
169
+ grid-template-columns: minmax(0, 1fr);
170
+ justify-items: center;
171
+ dl {
172
+ width: 100%;
173
+ }
174
+ }
175
+ .bar {
176
+ grid-template-columns: minmax(0, 1fr) auto;
177
+ gap: 4px 10px;
178
+ i {
179
+ grid-column: 1 / -1;
180
+ grid-row: 2;
181
+ }
182
+ }
183
+ }
@@ -0,0 +1,5 @@
1
+ import type { Locale } from "@sharadox/sharadox-web-library/content/locale/type";
2
+ export interface ClientProperties {
3
+ locale: Locale;
4
+ }
5
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../../../source/component/about/feed/client/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oDAAoD,CAAC;AAEjF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../../../source/component/about/feed/client/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { Locale } from "@sharadox/sharadox-web-library/content/locale/type";
2
+ /** An amount in euros, the way the language writes it ("€18,400", "18 400 €"). */
3
+ export declare const euros: (amount: number, locale: Locale) => string;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../source/component/about/feed/euros/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oDAAoD,CAAC;AAEjF,kFAAkF;AAClF,eAAO,MAAM,KAAK,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,WAKjC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /** An amount in euros, the way the language writes it ("€18,400", "18 400 €"). */
2
+ export const euros = (amount, locale) => new Intl.NumberFormat(locale === "pt" ? "pt-PT" : "en-GB", {
3
+ style: "currency",
4
+ currency: "EUR",
5
+ maximumFractionDigits: 0,
6
+ }).format(amount);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../source/component/about/feed/euros/index.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAAc,EAAE,MAAc,EAAE,EAAE,CACtD,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE;IACzD,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE,KAAK;IACf,qBAAqB,EAAE,CAAC;CACzB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"}
@@ -1,15 +1,10 @@
1
1
  import type { FeedProperties } from "@sharadox/sharadox-web-library/component/about/feed/type";
2
2
  /**
3
- * The platform at work, as a panel with three tabs that take turns (activity, a project, a client), under its live
4
- * header (the place it's being looked at from changes: Lisbon, London, New York, Tokyo).
5
- *
6
- * - **Activity:** what has just happened, ticking in one by one. Some of it done on its own (an order in, the invoice
7
- * sent, the customer told, the stock updated), some by people through it (John packed the order, Mary loaded the
8
- * van; their initials stand in for the tick).
9
- * - **Project:** one of the business's projects: its progress, tasks, milestones, and what was quoted and paid.
10
- * - **Client:** that project's client: what they've spent, what's quoted, and their projects so far.
11
- *
12
- * A picture, so it's hidden from assistive technology.
3
+ * The platform at work, as a business sees it in its own: a live header (the place it's viewed from changes) over
4
+ * three tabs, Activity, Project and Client, all about one job. Once the panel is in view a pointer plays through
5
+ * them: the log fills, the pointer reads an entry, clicks Project, reads the budget and ticks the next task, clicks
6
+ * Client and reads its charts, then goes back to Activity, over and over. Out of view it stops and starts over; with
7
+ * less motion asked for, it rests on the full log. A picture, so it's hidden from assistive technology.
13
8
  */
14
9
  export declare function Feed({ locale }: FeedProperties): import("react").JSX.Element;
15
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../source/component/about/feed/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0DAA0D,CAAC;AAa/F;;;;;;;;;;;GAWG;AACH,wBAAgB,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,cAAc,+BA0G9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../source/component/about/feed/index.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0DAA0D,CAAC;AAoC/F;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,cAAc,+BA8H9C"}
@@ -1,30 +1,107 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { AnimatePresence, motion } from "motion/react";
4
+ import { useEffect, useLayoutEffect, useRef, useState } from "react";
5
+ import { Icon } from "@sharadox/icon-web-library/icon";
2
6
  import { translate } from "@sharadox/internationalization-web-library/translate";
7
+ import { Activity } from "@sharadox/sharadox-web-library/component/about/feed/activity";
8
+ import { Client } from "@sharadox/sharadox-web-library/component/about/feed/client";
9
+ import { euros } from "@sharadox/sharadox-web-library/component/about/feed/euros";
10
+ import { Project } from "@sharadox/sharadox-web-library/component/about/feed/project";
11
+ import { playFeed } from "@sharadox/sharadox-web-library/component/about/feed/script";
3
12
  import { ABOUT } from "@sharadox/sharadox-web-library/content/about";
4
13
  import styles from "./index.module.css";
5
- /** The minute each event happened at, after the first one. */
6
- const minute = (index) => `09:${String(41 + index).padStart(2, "0")}`;
7
- /** An amount in euros, the way the language writes it ("€18,400", "18 400 €"). */
8
- const euros = (amount, locale) => new Intl.NumberFormat(locale === "pt" ? "pt-PT" : "en-GB", {
9
- style: "currency",
10
- currency: "EUR",
11
- maximumFractionDigits: 0,
12
- }).format(amount);
14
+ const { feed } = ABOUT.business;
15
+ const EASE = [0.22, 1, 0.36, 1];
16
+ /** The label a target shows while the pointer reads it. */
17
+ function tipFor(target, locale) {
18
+ const { project, client } = feed;
19
+ const [kind, index] = target.split("-");
20
+ if (kind === "event")
21
+ return translate(feed.events[Number(index)].detail, locale);
22
+ if (kind === "project") {
23
+ const past = client.projects[Number(index)];
24
+ return `${past[locale]} ${past.year} · ${euros(past.amount, locale)}`;
25
+ }
26
+ if (kind === "budget") {
27
+ const left = euros(project.quoted - project.paid, locale);
28
+ return `${Math.round((project.paid / project.quoted) * 100)}% ${translate(project.paidLabel, locale).toLowerCase()} · ${left}`;
29
+ }
30
+ if (kind === "donut")
31
+ return `${translate(client.paidLabel, locale)} ${euros(client.paid, locale)}`;
32
+ return `${client.tasks.done}/${client.tasks.total} ${translate(client.doneLabel, locale)}`;
33
+ }
34
+ /** Where a target is inside the panel: the pointer's spot on it, and the top middle for its label. */
35
+ function placeOf(root, target) {
36
+ const element = root.querySelector(`[data-target="${target}"]`);
37
+ const box = element.getBoundingClientRect();
38
+ const frame = root.getBoundingClientRect();
39
+ const left = box.left - frame.left;
40
+ const top = box.top - frame.top;
41
+ return {
42
+ pointer: { x: left + Math.min(box.width * 0.6, 120), y: top + box.height * 0.55 },
43
+ tip: { x: left + box.width / 2, y: top - 10 },
44
+ };
45
+ }
13
46
  /**
14
- * The platform at work, as a panel with three tabs that take turns (activity, a project, a client), under its live
15
- * header (the place it's being looked at from changes: Lisbon, London, New York, Tokyo).
16
- *
17
- * - **Activity:** what has just happened, ticking in one by one. Some of it done on its own (an order in, the invoice
18
- * sent, the customer told, the stock updated), some by people through it (John packed the order, Mary loaded the
19
- * van; their initials stand in for the tick).
20
- * - **Project:** one of the business's projects: its progress, tasks, milestones, and what was quoted and paid.
21
- * - **Client:** that project's client: what they've spent, what's quoted, and their projects so far.
22
- *
23
- * A picture, so it's hidden from assistive technology.
47
+ * The platform at work, as a business sees it in its own: a live header (the place it's viewed from changes) over
48
+ * three tabs, Activity, Project and Client, all about one job. Once the panel is in view a pointer plays through
49
+ * them: the log fills, the pointer reads an entry, clicks Project, reads the budget and ticks the next task, clicks
50
+ * Client and reads its charts, then goes back to Activity, over and over. Out of view it stops and starts over; with
51
+ * less motion asked for, it rests on the full log. A picture, so it's hidden from assistive technology.
24
52
  */
25
53
  export function Feed({ locale }) {
26
- const { feed } = ABOUT.business;
27
- const { project, client } = feed;
28
- return (_jsxs("div", { className: styles.feed, "aria-hidden": true, children: [_jsxs("div", { className: styles.header, children: [_jsxs("span", { className: styles.live, children: [_jsx("i", {}), translate(feed.live, locale)] }), _jsxs("span", { className: styles.viewing, children: [translate(feed.viewing, locale), _jsx("span", { className: styles.places, children: feed.places[locale].map((place) => (_jsx("b", { children: place }, place))) })] })] }), _jsxs("div", { className: styles.tabs, children: [feed.tabs.map((tab) => (_jsx("span", { children: translate(tab, locale) }, tab.en))), _jsx("i", { className: styles.underline })] }), _jsxs("div", { className: styles.panes, children: [_jsx("ol", { className: styles.events, children: feed.events.map((event, index) => (_jsxs("li", { children: ["by" in event ? _jsx("i", { className: styles.person, children: event.by }) : _jsx("i", { className: styles.check }), _jsx("span", { children: event[locale] }), _jsx("time", { className: "monospace", children: minute(index) })] }, event.en))) }), _jsxs("div", { className: styles.project, children: [_jsxs("div", { className: styles.title, children: [_jsxs("b", { children: [translate(project.name, locale), " \u00B7 ", project.client] }), _jsx("span", { className: styles.chip, children: translate(project.status, locale) })] }), _jsxs("div", { className: styles.meter, children: [_jsx("span", { children: translate(project.progressLabel, locale) }), _jsxs("b", { children: [project.progress, "%"] }), _jsx("i", { style: { "--to": `${project.progress}%` } })] }), _jsx("ul", { className: styles.milestones, children: project.milestones.map((milestone) => (_jsxs("li", { "data-state": milestone.state, children: [_jsx("i", {}), milestone[locale]] }, milestone.en))) }), _jsxs("div", { className: styles.figures, children: [_jsxs("span", { children: [translate(project.tasksLabel, locale), _jsxs("b", { children: [project.tasks.done, "/", project.tasks.total] })] }), _jsxs("span", { children: [translate(project.quotedLabel, locale), _jsx("b", { children: euros(project.quoted, locale) })] }), _jsxs("span", { children: [translate(project.paidLabel, locale), _jsx("b", { children: euros(project.paid, locale) })] })] })] }), _jsxs("div", { className: styles.client, children: [_jsxs("div", { className: styles.title, children: [_jsx("span", { className: styles.avatar, children: client.initials }), _jsxs("span", { children: [_jsx("b", { children: client.name }), _jsx("small", { children: translate(client.since, locale) })] })] }), _jsxs("div", { className: styles.figures, children: [_jsxs("span", { children: [translate(client.spentLabel, locale), _jsx("b", { children: euros(client.spent, locale) })] }), _jsxs("span", { children: [translate(client.openLabel, locale), _jsx("b", { children: euros(client.open, locale) })] })] }), _jsx("span", { className: styles.label, children: translate(client.projectsLabel, locale) }), _jsx("ul", { className: styles.history, children: client.projects.map((past) => (_jsxs("li", { "data-state": past.state, children: [_jsx("i", {}), _jsxs("span", { children: [past[locale], " ", _jsx("small", { children: past.year })] }), _jsx("b", { children: euros(past.amount, locale) })] }, past.en))) })] })] })] }));
54
+ const root = useRef(null);
55
+ const [inView, setInView] = useState(false);
56
+ useEffect(() => {
57
+ const observer = new IntersectionObserver(([entry]) => setInView(entry.isIntersecting), { threshold: 0.4 });
58
+ observer.observe(root.current);
59
+ return () => observer.disconnect();
60
+ }, []);
61
+ // Visitors who ask for less motion get the full log, still (read when the panel comes into view).
62
+ const playing = inView && !matchMedia("(prefers-reduced-motion: reduce)").matches;
63
+ const [tab, setTab] = useState(0);
64
+ const [shown, setShown] = useState(feed.events.length);
65
+ const [ticked, setTicked] = useState(false);
66
+ const [pointed, setPointed] = useState(null);
67
+ const [pressed, setPressed] = useState(0);
68
+ const [tip, setTip] = useState(null);
69
+ const [places, setPlaces] = useState({
70
+ pointer: { x: 0, y: 0 },
71
+ tip: { x: 0, y: 0 },
72
+ });
73
+ useEffect(() => {
74
+ if (!playing)
75
+ return;
76
+ const stop = new AbortController();
77
+ playFeed({
78
+ tab: setTab,
79
+ show: setShown,
80
+ tick: setTicked,
81
+ point: setPointed,
82
+ press: (down) => down && setPressed((count) => count + 1),
83
+ tip: setTip,
84
+ }, feed.events.length, stop.signal).catch(() => { });
85
+ return () => {
86
+ stop.abort();
87
+ setTab(0);
88
+ setShown(feed.events.length);
89
+ setTicked(false);
90
+ setPointed(null);
91
+ setTip(null);
92
+ };
93
+ }, [playing]);
94
+ // The pointer and its label follow their target, which is outlined while the pointer is on it.
95
+ useLayoutEffect(() => {
96
+ const panel = root.current;
97
+ for (const element of panel.querySelectorAll("[data-pointed]"))
98
+ element.removeAttribute("data-pointed");
99
+ if (!pointed)
100
+ return;
101
+ setPlaces(placeOf(panel, pointed));
102
+ if (!pointed.startsWith("tab"))
103
+ panel.querySelector(`[data-target="${pointed}"]`).setAttribute("data-pointed", "");
104
+ }, [pointed, tab, shown]);
105
+ return (_jsxs("div", { ref: root, className: styles.feed, "data-playing": playing || undefined, "aria-hidden": true, children: [_jsxs("div", { className: styles.header, children: [_jsxs("span", { className: styles.live, children: [_jsx("i", {}), translate(feed.live, locale)] }), _jsxs("span", { className: styles.viewing, children: [translate(feed.viewing, locale), _jsx("span", { className: styles.places, children: feed.places[locale].map((place) => (_jsx("b", { children: place }, place))) })] })] }), _jsxs("div", { className: styles.tabs, children: [feed.tabs.map((name, index) => (_jsx("span", { "data-target": `tab-${index}`, "data-active": tab === index || undefined, children: translate(name, locale) }, name.en))), _jsx("i", { className: styles.underline, style: { transform: `translateX(${tab * 100}%)` } })] }), _jsxs("div", { className: styles.panes, children: [_jsx("div", { "data-active": tab === 0 || undefined, children: _jsx(Activity, { locale: locale, shown: shown }) }), _jsx("div", { "data-active": tab === 1 || undefined, children: _jsx(Project, { locale: locale, ticked: ticked }) }), _jsx("div", { "data-active": tab === 2 || undefined, children: _jsx(Client, { locale: locale }) })] }), _jsx(AnimatePresence, { children: tip && (_jsx(motion.div, { className: styles.tip, style: { left: places.tip.x, top: places.tip.y, x: "-50%", y: "-100%" }, initial: { opacity: 0, scale: 0.92 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.96 }, transition: { duration: 0.25, ease: EASE }, children: tipFor(tip, locale) }, tip)) }), _jsxs(motion.div, { className: styles.pointer, initial: false, animate: { x: places.pointer.x, y: places.pointer.y, opacity: pointed ? 1 : 0 }, transition: { duration: 0.8, ease: EASE }, children: [_jsx(AnimatePresence, { children: pressed > 0 && (_jsx(motion.span, { className: styles.ripple, initial: { opacity: 0.9, scale: 0.3 }, animate: { opacity: 0, scale: 1.4 }, transition: { duration: 0.6 } }, pressed)) }), _jsx(Icon, { name: "pointer", strokeWidth: 1.4 })] })] }));
29
106
  }
30
107
  //# sourceMappingURL=index.js.map