Skip to content

Commit ea68470

Browse files
committed
Improvements on translation and instagram component
1 parent 8bd2448 commit ea68470

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

app/[locale]/[id]/_components/HighlineHeader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { MapPinIcon } from "lucide-react";
44
import { useTranslations } from "next-intl";
55
import { useEffect, useRef, useState } from "react";
66

7-
import type { Highline } from "@/app/actions/getHighline";
87
import { RegistryEntry } from "@/app/[locale]/[id]/_components/RegistryEntry";
8+
import type { Highline } from "@/app/actions/getHighline";
99
import { Button } from "@/components/ui/button";
1010
import { CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
1111
import { cn } from "@/lib/utils";

app/[locale]/[id]/_components/RegistryEntry.tsx

+18-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import MultiSelectFormField from "./witness-select";
4040
const formSchema = z.object({
4141
instagram: z
4242
.string()
43+
.trim()
4344
.startsWith("@", "O usuário deve começar com @")
4445
.min(3, "Deve conter ao menos 3 caracteres"),
4546
cadenas: z.number().nonnegative(),
@@ -92,6 +93,19 @@ export const RegistryEntry = ({ highlineId, highlineDistance }: Props) => {
9293
},
9394
});
9495

96+
useEffect(() => {
97+
async function setUsername() {
98+
const {
99+
data: { session },
100+
} = await supabase.auth.getSession();
101+
entryForm.setValue(
102+
"instagram",
103+
session?.user.user_metadata["username"] || ""
104+
);
105+
}
106+
setUsername();
107+
}, [supabase.auth, entryForm]);
108+
95109
const watchCadenas = entryForm.watch("cadenas");
96110
const watchFullLines = entryForm.watch("full_lines");
97111

@@ -184,7 +198,10 @@ export const RegistryEntry = ({ highlineId, highlineDistance }: Props) => {
184198
name="instagram"
185199
render={({ field }) => (
186200
<FormItem>
187-
<FormLabel>Instagram</FormLabel>
201+
<FormLabel>Highliner</FormLabel>
202+
<FormDescription>
203+
{t("instagram.description")}
204+
</FormDescription>
188205
<FormControl>
189206
<Input
190207
placeholder={t("instagram.placeholder")}

messages/en.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
},
7474
"description": "Registry your walk and get access to your statistics.",
7575
"instagram": {
76-
"placeholder": "Your @ on instragram"
76+
"description": "Username on the Chooselife APP or instragram @",
77+
"placeholder": "@user"
7778
},
7879
"cadenas": {
7980
"label": "Sent",

messages/pt.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
},
7474
"description": "Registre como foi o seu rolê e tenha acesso as suas estatísticas.",
7575
"instagram": {
76-
"placeholder": "Seu @ do instragram"
76+
"description": "Nome de úsuario no APP Chooselife ou o @ do instagram",
77+
"placeholder": "@user"
7778
},
7879
"cadenas": {
7980
"label": "Cadenas",
@@ -93,7 +94,7 @@
9394
},
9495
"witness": {
9596
"label": "Testemunhas",
96-
"description": "Selectione dois úsuario para ser sua testeminha, se a pessoa não tiver no APP use o @ do instagram dela",
97+
"description": "Selecione dois úsuario para ser testemunha, se a pessoa não tiver no APP use o @ do instagram dela",
9798
"placeholder": "Exemplo: @festivalchooselife, @juangsandrade",
9899
"searchPlaceholder": "Username ou @ do instagram",
99100
"clear": "Limpar",

0 commit comments

Comments
 (0)