From 2489e94b0e3123387bc2a60231f65ca00344c09d Mon Sep 17 00:00:00 2001 From: pluja Date: Wed, 4 Jun 2025 21:53:07 +0000 Subject: [PATCH] Release 202506042153 --- web/src/constants/serviceSuggestionStatus.ts | 12 +- web/src/pages/about.mdx | 4 +- .../admin/service-suggestions/[id].astro | 181 ++++++++---------- web/src/pages/service-suggestion/[id].astro | 44 +++-- 4 files changed, 113 insertions(+), 128 deletions(-) diff --git a/web/src/constants/serviceSuggestionStatus.ts b/web/src/constants/serviceSuggestionStatus.ts index 4c73adb..af04a34 100644 --- a/web/src/constants/serviceSuggestionStatus.ts +++ b/web/src/constants/serviceSuggestionStatus.ts @@ -8,7 +8,7 @@ type ServiceSuggestionStatusInfo = slug: string label: string icon: string - iconClass: string + color: string default: boolean } @@ -28,7 +28,7 @@ export const { slug: value ? value.toLowerCase() : '', label: value ? transformCase(value, 'title') : String(value), icon: 'ri:question-line', - iconClass: 'text-current/60', + color: 'gray', default: false, }), [ @@ -37,7 +37,7 @@ export const { slug: 'pending', label: 'Pending', icon: 'ri:time-line', - iconClass: 'text-yellow-400', + color: 'yellow', default: true, }, { @@ -45,7 +45,7 @@ export const { slug: 'approved', label: 'Approved', icon: 'ri:check-line', - iconClass: 'text-green-400', + color: 'green', default: false, }, { @@ -53,7 +53,7 @@ export const { slug: 'rejected', label: 'Rejected', icon: 'ri:close-line', - iconClass: 'text-red-400', + color: 'red', default: false, }, { @@ -61,7 +61,7 @@ export const { slug: 'withdrawn', label: 'Withdrawn', icon: 'ri:arrow-left-line', - iconClass: 'text-gray-400', + color: 'gray', default: false, }, ] as const satisfies ServiceSuggestionStatusInfo[] diff --git a/web/src/pages/about.mdx b/web/src/pages/about.mdx index 07334f9..9a8b87f 100644 --- a/web/src/pages/about.mdx +++ b/web/src/pages/about.mdx @@ -147,7 +147,7 @@ The privacy score measures how well a service protects user privacy, using a tra 3. **Onion URL:** **+5 points** if the service offers at least one Onion (Tor) URL. 4. **I2P URL:** **+5 points** if the service offers at least one I2P URL. 5. **Monero Acceptance:** **+5 points** if the service accepts Monero as a payment method. -6. **Privacy Attributes:** The sum of all privacy points from attributes categorized as 'PRIVACY' is added to the score. +6. **Privacy Attributes:** The sum of all privacy points from attributes categorized as 'PRIVACY' is added to the score. [See all attributes](/attributes). 7. **Final Score Range:** The final score is always kept between 0 and 100. #### Trust Score @@ -160,7 +160,7 @@ The trust score represents how reliable and trustworthy a service is, based on o - **Approved:** +5 points - **Community Contributed:** 0 points - **Verification Failed (SCAM):** -50 points -3. **Trust Attributes:** The total trust points from all attributes categorized as 'TRUST' are added to the score. +3. **Trust Attributes:** The total trust points from all attributes categorized as 'TRUST' are added to the score. [See all attributes](/attributes). 4. **Recently Listed Penalty & Flag:** If a service was listed within the last 15 days and its status is `APPROVED`, a penalty of -10 points is applied to the trust score, and the service is flagged as recently listed. 5. **Final Score Range:** The final score is always kept between 0 and 100. diff --git a/web/src/pages/admin/service-suggestions/[id].astro b/web/src/pages/admin/service-suggestions/[id].astro index 1d0462e..1f3b2a4 100644 --- a/web/src/pages/admin/service-suggestions/[id].astro +++ b/web/src/pages/admin/service-suggestions/[id].astro @@ -1,10 +1,11 @@ --- import { Icon } from 'astro-icon/components' -import { actions } from 'astro:actions' +import { actions, isInputError } from 'astro:actions' import BadgeSmall from '../../../components/BadgeSmall.astro' import Button from '../../../components/Button.astro' import Chat from '../../../components/Chat.astro' +import InputSelect from '../../../components/InputSelect.astro' import ServiceCard from '../../../components/ServiceCard.astro' import UserBadge from '../../../components/UserBadge.astro' import { @@ -17,12 +18,20 @@ import { cn } from '../../../lib/cn' import { parseIntWithFallback } from '../../../lib/numbers' import { prisma } from '../../../lib/prisma' import { makeLoginUrl } from '../../../lib/redirectUrls' +import { formatDateShort } from '../../../lib/timeAgo' +import BadgeStandard from '../../../components/BadgeStandard.astro' const user = Astro.locals.user if (!user?.admin) { return Astro.redirect(makeLoginUrl(Astro.url, { message: 'Admin access required' })) } +const serviceSuggestionUpdateResult = Astro.getActionResult(actions.admin.serviceSuggestions.update) +Astro.locals.banners.addIfSuccess(serviceSuggestionUpdateResult, 'Service suggestion updated successfully') +const serviceSuggestionUpdateInputErrors = isInputError(serviceSuggestionUpdateResult?.error) + ? serviceSuggestionUpdateResult.error.fields + : {} + const { id: serviceSuggestionIdRaw } = Astro.params const serviceSuggestionId = parseIntWithFallback(serviceSuggestionIdRaw) if (!serviceSuggestionId) { @@ -100,114 +109,88 @@ const typeInfo = getServiceSuggestionTypeInfo(serviceSuggestion.type) -
-
- -
-
- -
- -
-

Suggestion Details

- -
- Type: - - - Status: - - - {statusInfo.label} - - - Submitted by: - - - Submitted at: - {serviceSuggestion.createdAt.toLocaleString()} - - Service page: - - View Service - +
+
+
+ Status: +
+
+ Type: + +
+ +
+ Author: + +
+ +
+ Submitted: + + { + formatDateShort(serviceSuggestion.createdAt, { + prefix: false, + hourPrecision: true, + caseType: 'sentence', + }) + } + +
+ +
+ Service: + + Open + +
+
+ +
+ Notes for moderators: { - serviceSuggestion.notes && ( -
-

Notes from user:

-
-
+ serviceSuggestion.notes ? ( +
+ ) : ( +
Empty
) }
-
-
-
-

Messages

+
+ + ({ + label: status.label, + value: status.value, + }))} + selectProps={{ value: serviceSuggestion.status }} + class="flex-1" + error={serviceSuggestionUpdateInputErrors.status} + /> +
-
- - -
- - -
+ diff --git a/web/src/pages/service-suggestion/[id].astro b/web/src/pages/service-suggestion/[id].astro index bf39484..2292ee2 100644 --- a/web/src/pages/service-suggestion/[id].astro +++ b/web/src/pages/service-suggestion/[id].astro @@ -111,9 +111,9 @@ const typeInfo = getServiceSuggestionTypeInfo(serviceSuggestion.type) }, ]} > -
-
- +
+

Service suggestion

+
- -

Service suggestion

-
+
- Status: - - - {statusInfo.label} - + Status: +
- Submitted: + Type: + +
+ +
+ Submitted: { formatDateShort(serviceSuggestion.createdAt, { @@ -157,15 +152,22 @@ const typeInfo = getServiceSuggestionTypeInfo(serviceSuggestion.type) }
+ +
+ Service: + + Open + +
-
-
Notes for moderators:
+
+ Notes for moderators: { serviceSuggestion.notes ? ( -
+
) : ( - Empty +
Empty
) }