@autobusal/utilities 1.5.2 → 1.5.4
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/CHANGELOG.md +10 -0
- package/check-backticks.mjs +34 -0
- package/package.json +1 -1
- package/users.tsx +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.5.4 (2026-08-28)
|
|
4
|
+
|
|
5
|
+
- DisplayStatus renders status 4 (awaiting approval) as a badge instead of a blank cell in the admin agent/visitor/API-consumer lists (sweep #61).
|
|
6
|
+
|
|
7
|
+
## 1.5.3
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **The backtick guard tripped on prose about styled-components**, and was refusing to publish the whole repo. Its opening pattern matches `styled.x` followed by a backtick as *text*, so a JSDoc line describing another file - "labels as `<span>` (Viewer/styles.ts: `Label = styled.span`)" - opened a template no code had opened, and every comment up to the next `` `; `` in the file counted as inside it. A comment about the hazard tripping the guard against the hazard. Openings found inside comments are now ignored; backticks inside comments, which are the thing being hunted, still are not.
|
|
12
|
+
|
|
3
13
|
## 1.5.2
|
|
4
14
|
|
|
5
15
|
### Changed
|
package/check-backticks.mjs
CHANGED
|
@@ -52,10 +52,44 @@ const walk = (dir) => readdirSync(dir).flatMap((entry) => {
|
|
|
52
52
|
|
|
53
53
|
const found = [];
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Where the comments are, as [start, end) offsets.
|
|
57
|
+
*
|
|
58
|
+
* Edited: Claude - Date: 2026-08-21
|
|
59
|
+
*
|
|
60
|
+
* Needed because OPEN matches `styled.x` + a backtick as TEXT, and prose
|
|
61
|
+
* about styled-components looks exactly like styled-components. A JSDoc
|
|
62
|
+
* line reading "labels as <span> (Viewer/styles.ts: `Label = styled.span`)"
|
|
63
|
+
* opened a template here that no code ever opened, and everything up to the
|
|
64
|
+
* next `; in the file - thirty-six lines of unrelated JSDoc - was then
|
|
65
|
+
* inside it. That is what refused to publish this repo: a comment ABOUT the
|
|
66
|
+
* hazard tripping the guard against the hazard.
|
|
67
|
+
*
|
|
68
|
+
* Comments cannot simply be stripped first: backticks in comments are the
|
|
69
|
+
* whole thing being looked for. Only the OPENING has to ignore them.
|
|
70
|
+
*/
|
|
71
|
+
const commentRanges = (text) => {
|
|
72
|
+
const ranges = [];
|
|
73
|
+
const pattern = /\/\*[\s\S]*?\*\/|\/\/[^\n]*/g;
|
|
74
|
+
|
|
75
|
+
for (const match of text.matchAll(pattern)) {
|
|
76
|
+
ranges.push([match.index, match.index + match[0].length]);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return ranges;
|
|
80
|
+
};
|
|
81
|
+
|
|
55
82
|
for (const path of walk(process.argv[2] ?? 'packages')) {
|
|
56
83
|
const text = readFileSync(path, 'utf8');
|
|
84
|
+
const comments = commentRanges(text);
|
|
85
|
+
const commented = (at) => comments.some(([from, to]) => at >= from && at < to);
|
|
57
86
|
|
|
58
87
|
for (const match of text.matchAll(OPEN)) {
|
|
88
|
+
// a styled template named inside a comment is prose, not a template
|
|
89
|
+
if (commented(match.index)) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
|
|
59
93
|
const start = match.index + match[0].length;
|
|
60
94
|
const end = text.indexOf('`;', start);
|
|
61
95
|
|
package/package.json
CHANGED
package/users.tsx
CHANGED
|
@@ -82,10 +82,24 @@ const Status = styled.span<{ $type: string }>`
|
|
|
82
82
|
${ props => props.$type === 'unavailable' && css`
|
|
83
83
|
background: #FFB4B4;
|
|
84
84
|
` }
|
|
85
|
+
${ props => props.$type === 'awaiting' && css`
|
|
86
|
+
background: #D9B8FF;
|
|
87
|
+
` }
|
|
85
88
|
`;
|
|
86
89
|
|
|
87
90
|
export const DisplayStatus = (status: number, t: TFunction<'common'>): (JSX.Element | null) => {
|
|
88
91
|
switch (status) {
|
|
92
|
+
// Edited: Claude - Date: 2026-08-28 (sweep, low): status 4 is "waiting
|
|
93
|
+
// for approval" (a self-registered agency that completed its profile) -
|
|
94
|
+
// GetStatus above always listed it, but this switch had no case, so
|
|
95
|
+
// precisely the rows needing the admin's decision showed a blank cell
|
|
96
|
+
case 4:
|
|
97
|
+
return (
|
|
98
|
+
<Status $type="awaiting">
|
|
99
|
+
{ t('data.statuses.awaiting', { ns: 'common' }) }
|
|
100
|
+
</Status>
|
|
101
|
+
);
|
|
102
|
+
|
|
89
103
|
case 3:
|
|
90
104
|
return (
|
|
91
105
|
<Status $type="pending">
|