Update RideshareComposer to reflect pricing in satoshis

- Changed price labels and descriptions to specify 'sats' instead of dollars, enhancing clarity for users.
- Updated the price field type from string to number, ensuring proper validation and handling of input.
- Adjusted content generation to display prices in satoshis, aligning with the overall theme of the rideshare feature.

These changes improve the user experience by providing clearer financial information in the RideshareComposer component.
This commit is contained in:
padreug 2025-09-17 19:36:13 +02:00
parent 3c20d1c584
commit ff60277ae9

View file

@ -130,21 +130,22 @@
<!-- Price/Cost -->
<FormField v-slot="{ componentField }" name="price">
<FormItem>
<FormLabel>{{ watchedType === 'offering' ? 'Price per person' : 'Willing to pay' }}</FormLabel>
<FormLabel>{{ watchedType === 'offering' ? 'Price per person (sats)' : 'Willing to pay (sats)' }}</FormLabel>
<FormControl>
<div class="flex items-center gap-2">
<span class="text-sm text-muted-foreground">$</span>
<span class="text-sm text-muted-foreground"></span>
<Input
type="number"
placeholder="0.00"
step="0.01"
placeholder="0"
step="1"
min="0"
v-bind="componentField"
/>
<span class="text-sm text-muted-foreground">sats</span>
</div>
</FormControl>
<FormDescription>
{{ watchedType === 'offering' ? 'Cost per passenger (optional)' : 'Maximum you\'re willing to pay (optional)' }}
{{ watchedType === 'offering' ? 'Cost per passenger in satoshis (optional)' : 'Maximum satoshis you\'re willing to pay (optional)' }}
</FormDescription>
<FormMessage />
</FormItem>
@ -271,7 +272,7 @@ const rideshareSchema = toTypedSchema(z.object({
),
time: z.string().min(1, "Time is required"),
seats: z.string().optional(),
price: z.string().optional(),
price: z.number().int().min(0, "Price must be positive").optional().or(z.literal('')).transform(val => val === '' ? undefined : val),
details: z.string().max(200, "Details too long").optional(),
contactMethod: z.enum(['nostr-dm', 'replies', 'other']).optional(),
}))
@ -286,7 +287,7 @@ const form = useForm({
date: '',
time: '',
seats: '',
price: '',
price: undefined as number | undefined,
details: '',
contactMethod: 'nostr-dm'
}
@ -327,7 +328,7 @@ const generateRideshareContent = (values: any): string => {
if (values.price) {
const priceLabel = values.type === 'offering' ? 'Price per person' : 'Willing to pay'
content += `💰 ${priceLabel}: $${values.price}\n`
content += `💰 ${priceLabel}: ${values.price} sats\n`
}
if (values.contactMethod) {