This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
// Imported from investidor/resources/js/modules/news/pages/AboutPage.tsx.
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Head } from '@inertiajs/react';
|
||||
import { AboutStory } from '@/components/institutional-source/AboutStory';
|
||||
import { MissionVision } from '@/components/institutional-source/MissionVision';
|
||||
import { CompanyValues } from '@/components/institutional-source/CompanyValues';
|
||||
import BackButton from '@/components/institutional-source/BackButton';
|
||||
import { AdvertisementSlot } from '@/components/institutional-source/source-advertisement-slot';
|
||||
|
||||
const AboutPage: React.FC = () => {
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
setLoading(false);
|
||||
}, 300);
|
||||
return () => clearTimeout(timer);
|
||||
}, []);
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center pt-20">
|
||||
<div className="h-12 w-12 animate-spin rounded-full border-4 border-red-600 border-t-transparent"></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="tempo-source-page tempo-about-page min-h-screen bg-[#1f1f1f] pt-[3px]">
|
||||
<Head title="Sobre nós" />
|
||||
<BackButton label="Voltar" className="mb-1" />
|
||||
|
||||
<header className="relative overflow-hidden px-6 pb-2 md:px-12 lg:px-20">
|
||||
<div className="relative z-10 mx-auto w-full max-w-7xl px-6 md:px-12 lg:px-20">
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-4xl leading-tight font-light text-white sm:text-6xl lg:text-5xl">
|
||||
Ajudamos a construir o{' '}
|
||||
<span className="bg-gradient-to-r from-red-500 to-red-700 bg-clip-text text-transparent italic">
|
||||
futuro
|
||||
</span>{' '}
|
||||
de Moçambique
|
||||
</h1>
|
||||
<div className="h-[3px] w-16 rounded-full bg-[#ED1C24]" />
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<AdvertisementSlot
|
||||
page="about"
|
||||
position="top"
|
||||
slot="about_top"
|
||||
limit={1}
|
||||
fallbackToUnslotted
|
||||
className=""
|
||||
/>
|
||||
|
||||
<div className="text-white">
|
||||
<AboutStory />
|
||||
<MissionVision />
|
||||
<CompanyValues />
|
||||
</div>
|
||||
|
||||
<AdvertisementSlot
|
||||
page="about"
|
||||
position="bottom"
|
||||
slot="about_bottom"
|
||||
limit={2}
|
||||
fallbackToUnslotted
|
||||
className="py-4"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AboutPage;
|
||||
@@ -0,0 +1,552 @@
|
||||
// Imported from investidor/resources/js/domains/investor-portal/components/contactpage/institutional-contact.tsx.
|
||||
// Shell and submission endpoint adapted to InvesteMoz; page content and form retained.
|
||||
import { useMemo, useState } from 'react';
|
||||
import { Head } from '@inertiajs/react';
|
||||
import {
|
||||
AlertCircle,
|
||||
CheckCircle2,
|
||||
FileText,
|
||||
Loader2,
|
||||
Mail,
|
||||
MessageCircle,
|
||||
MessageSquare,
|
||||
Phone,
|
||||
Send,
|
||||
User,
|
||||
X,
|
||||
} from 'lucide-react';
|
||||
import InstituitionalMaps from '@/components/institutional-source/institutional-map';
|
||||
|
||||
type FormData = {
|
||||
name: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
subject: string;
|
||||
message: string;
|
||||
};
|
||||
type FieldName = keyof FormData;
|
||||
type FormErrors = Partial<Record<FieldName, string>>;
|
||||
|
||||
const contactMessagesEndpoint = '/contacto/mensagem';
|
||||
const emptyForm: FormData = {
|
||||
name: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
subject: '',
|
||||
message: '',
|
||||
};
|
||||
|
||||
function extractPhoneMZ(value: string) {
|
||||
const digits = value.replace(/\D/g, '');
|
||||
if (digits.length > 9 && digits.startsWith('258'))
|
||||
return digits.slice(3, 12);
|
||||
return digits.slice(0, 9);
|
||||
}
|
||||
|
||||
function maskPhoneMZ(value: string) {
|
||||
const digits = extractPhoneMZ(value);
|
||||
if (digits.length <= 2) return digits;
|
||||
if (digits.length <= 5) return `${digits.slice(0, 2)} ${digits.slice(2)}`;
|
||||
return `${digits.slice(0, 2)} ${digits.slice(2, 5)} ${digits.slice(5)}`;
|
||||
}
|
||||
|
||||
function validateField(field: FieldName, value: string) {
|
||||
const trimmed = value.trim();
|
||||
if (field === 'phone') {
|
||||
const digits = extractPhoneMZ(value);
|
||||
return digits && digits.length !== 9
|
||||
? 'Introduza exactamente 9 dígitos depois de +258.'
|
||||
: '';
|
||||
}
|
||||
if (!trimmed) return 'Este campo é obrigatório.';
|
||||
if (field === 'name' && trimmed.length < 2) return 'Nome muito curto.';
|
||||
if (field === 'email' && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(trimmed)) {
|
||||
return 'Endereço de email inválido.';
|
||||
}
|
||||
if (field === 'subject' && trimmed.length < 3)
|
||||
return 'Assunto muito curto.';
|
||||
if (field === 'subject' && trimmed.length > 100)
|
||||
return 'Assunto muito longo (máximo 100 caracteres).';
|
||||
if (field === 'message' && trimmed.length < 10)
|
||||
return 'Mensagem muito curta (mínimo 10 caracteres).';
|
||||
if (field === 'message' && trimmed.length > 2000)
|
||||
return 'Mensagem muito longa (máximo 2000 caracteres).';
|
||||
return '';
|
||||
}
|
||||
|
||||
const Contact = () => {
|
||||
const [showForm, setShowForm] = useState(false);
|
||||
const [data, setData] = useState<FormData>(emptyForm);
|
||||
const [errors, setErrors] = useState<FormErrors>({});
|
||||
const [touched, setTouched] = useState<Partial<Record<FieldName, boolean>>>(
|
||||
{},
|
||||
);
|
||||
const [processing, setProcessing] = useState(false);
|
||||
const [sent, setSent] = useState(false);
|
||||
const [submitError, setSubmitError] = useState('');
|
||||
|
||||
const isValid = useMemo(
|
||||
() =>
|
||||
(Object.keys(data) as FieldName[]).every(
|
||||
(field) => !validateField(field, data[field]),
|
||||
),
|
||||
[data],
|
||||
);
|
||||
|
||||
const setField = (field: FieldName, value: string) => {
|
||||
const nextValue = field === 'phone' ? maskPhoneMZ(value) : value;
|
||||
setData((current) => ({ ...current, [field]: nextValue }));
|
||||
setSent(false);
|
||||
setSubmitError('');
|
||||
if (touched[field]) {
|
||||
setErrors((current) => ({
|
||||
...current,
|
||||
[field]: validateField(field, nextValue),
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const blurField = (field: FieldName) => {
|
||||
setTouched((current) => ({ ...current, [field]: true }));
|
||||
setErrors((current) => ({
|
||||
...current,
|
||||
[field]: validateField(field, data[field]),
|
||||
}));
|
||||
};
|
||||
|
||||
const handleSubmit = async (event: React.FormEvent) => {
|
||||
event.preventDefault();
|
||||
const nextErrors: FormErrors = {};
|
||||
(Object.keys(data) as FieldName[]).forEach((field) => {
|
||||
const error = validateField(field, data[field]);
|
||||
if (error) nextErrors[field] = error;
|
||||
});
|
||||
setTouched({
|
||||
name: true,
|
||||
email: true,
|
||||
phone: true,
|
||||
subject: true,
|
||||
message: true,
|
||||
});
|
||||
setErrors(nextErrors);
|
||||
if (Object.keys(nextErrors).length) return;
|
||||
|
||||
setProcessing(true);
|
||||
setSent(false);
|
||||
setSubmitError('');
|
||||
try {
|
||||
const response = await fetch(contactMessagesEndpoint, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'X-XSRF-TOKEN': decodeURIComponent(
|
||||
document.cookie
|
||||
.split('; ')
|
||||
.find((cookie) => cookie.startsWith('XSRF-TOKEN='))
|
||||
?.slice(11) ?? '',
|
||||
),
|
||||
},
|
||||
body: JSON.stringify({
|
||||
platform: 'InvesteMoz',
|
||||
name: data.name.trim(),
|
||||
email: data.email.trim(),
|
||||
phone: extractPhoneMZ(data.phone) || null,
|
||||
subject: data.subject.trim(),
|
||||
message: data.message.trim(),
|
||||
}),
|
||||
});
|
||||
const result = await response.json().catch(() => null);
|
||||
if (!response.ok) {
|
||||
const validationMessage = result?.errors
|
||||
? Object.values(result.errors as Record<string, string[]>)
|
||||
.flat()
|
||||
.join(' ')
|
||||
: '';
|
||||
throw new Error(
|
||||
validationMessage ||
|
||||
result?.message ||
|
||||
'Não foi possível enviar a mensagem. Tente novamente.',
|
||||
);
|
||||
}
|
||||
setData(emptyForm);
|
||||
setTouched({});
|
||||
setErrors({});
|
||||
setSent(true);
|
||||
} catch (error) {
|
||||
setSubmitError(
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: 'Não foi possível enviar a mensagem. Tente novamente.',
|
||||
);
|
||||
} finally {
|
||||
setProcessing(false);
|
||||
}
|
||||
};
|
||||
|
||||
const fieldClass = (field: FieldName) =>
|
||||
`w-full rounded-lg border bg-white/5 px-4 py-3.5 text-white outline-none transition placeholder:text-white/40 ${
|
||||
errors[field] && touched[field]
|
||||
? 'border-red-500 ring-2 ring-red-500/20'
|
||||
: 'border-white/20 focus:border-red-500 focus:bg-white/10 focus:ring-2 focus:ring-red-500/20'
|
||||
}`;
|
||||
|
||||
const ErrorMessage = ({ field }: { field: FieldName }) =>
|
||||
errors[field] && touched[field] ? (
|
||||
<p className="mt-1 flex items-center gap-1 text-xs text-red-400">
|
||||
<AlertCircle className="h-3 w-3" />
|
||||
{errors[field]}
|
||||
</p>
|
||||
) : null;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title="Contacto" />
|
||||
<main className="tempo-source-page">
|
||||
<div className="min-h-screen bg-[#1f1f1f] pt-8 text-white">
|
||||
<header className="relative overflow-hidden px-6 pb-2 md:px-12 lg:px-20">
|
||||
<div className="pointer-events-none absolute inset-0 z-0">
|
||||
<div className="absolute top-0 left-1/4 h-96 w-96 rounded-full bg-red-600/10 blur-3xl" />
|
||||
<div className="absolute right-1/4 bottom-0 h-96 w-96 rounded-full bg-purple-600/10 blur-3xl" />
|
||||
</div>
|
||||
<div className="relative z-10 mx-auto w-full max-w-7xl px-6 md:px-12 lg:px-20">
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-5xl leading-tight font-light text-white md:text-6xl">
|
||||
Vamos{' '}
|
||||
<span className="bg-gradient-to-r from-red-500 to-red-700 bg-clip-text text-transparent italic">
|
||||
conversar
|
||||
</span>
|
||||
</h1>
|
||||
<div className="h-[3px] w-16 rounded-full bg-[#ED1C24]" />
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section className="bg-[#1f1f1f] px-4 py-4 sm:px-4 md:px-8 lg:px-20">
|
||||
<div className="mx-auto grid max-w-6xl grid-cols-1 items-start gap-6 lg:grid-cols-2 lg:gap-8">
|
||||
<div className="order-2 space-y-5 rounded-3xl border border-white/10 bg-[#2a2a2a] p-5 shadow-2xl sm:p-6 lg:order-1 lg:p-8">
|
||||
<h3 className="mb-5 text-center font-serif text-xl font-bold tracking-tight text-white">
|
||||
Informações de Contacto
|
||||
</h3>
|
||||
<div className="flex flex-col gap-3">
|
||||
<a
|
||||
href="https://wa.me/258868010880"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center gap-4 rounded-xl px-4 py-3 font-medium text-white transition hover:opacity-80 active:scale-95"
|
||||
>
|
||||
<div className="flex h-10 w-10 items-center justify-center">
|
||||
<MessageCircle className="text-xl text-[#25D366]" />
|
||||
</div>
|
||||
<span>WhatsApp</span>
|
||||
</a>
|
||||
<a
|
||||
href="tel:+258868010880"
|
||||
className="flex items-center gap-4 rounded-xl px-4 py-3 font-medium text-white transition hover:opacity-80 active:scale-95"
|
||||
>
|
||||
<div className="flex h-10 w-10 items-center justify-center">
|
||||
<Phone
|
||||
size={20}
|
||||
className="text-[#2563EB]"
|
||||
/>
|
||||
</div>
|
||||
<span>Ligar Agora</span>
|
||||
</a>
|
||||
<button
|
||||
onClick={() => setShowForm(!showForm)}
|
||||
className="flex w-full items-center gap-4 rounded-xl px-4 py-3 font-medium text-white transition hover:opacity-80 active:scale-95"
|
||||
>
|
||||
<div className="flex h-10 w-10 items-center justify-center">
|
||||
{showForm ? (
|
||||
<X
|
||||
size={20}
|
||||
className="text-red-500"
|
||||
/>
|
||||
) : (
|
||||
<Mail size={20} />
|
||||
)}
|
||||
</div>
|
||||
<span>
|
||||
{showForm
|
||||
? 'Fechar Formulário'
|
||||
: 'Solicitar Serviços'}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="order-1 lg:order-2">
|
||||
{showForm && (
|
||||
<div className="animate-in fade-in slide-in-from-bottom-4 rounded-3xl border border-white/10 bg-[#2a2a2a] p-5 shadow-2xl duration-500 sm:p-6 lg:p-8">
|
||||
<div className="mb-10 text-center">
|
||||
<h2 className="mb-3 text-4xl font-bold text-white md:text-5xl">
|
||||
Fale Connosco.
|
||||
</h2>
|
||||
<p className="text-lg text-white/70">
|
||||
Envie uma mensagem,
|
||||
responderemos com atenção.
|
||||
</p>
|
||||
</div>
|
||||
<form
|
||||
onSubmit={handleSubmit}
|
||||
className="space-y-6"
|
||||
noValidate
|
||||
>
|
||||
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
||||
<div className="space-y-2">
|
||||
<label
|
||||
htmlFor="name"
|
||||
className="flex items-center gap-2 text-sm font-medium text-white/90"
|
||||
>
|
||||
<User className="h-4 w-4 text-white/60" />
|
||||
Nome Completo
|
||||
<span className="text-red-400">
|
||||
*
|
||||
</span>
|
||||
</label>
|
||||
<input
|
||||
id="name"
|
||||
value={data.name}
|
||||
onChange={(e) =>
|
||||
setField(
|
||||
'name',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
onBlur={() =>
|
||||
blurField('name')
|
||||
}
|
||||
placeholder="Seu nome..."
|
||||
className={fieldClass(
|
||||
'name',
|
||||
)}
|
||||
/>
|
||||
<ErrorMessage field="name" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label
|
||||
htmlFor="email"
|
||||
className="flex items-center gap-2 text-sm font-medium text-white/90"
|
||||
>
|
||||
<Mail className="h-4 w-4 text-white/60" />
|
||||
Email
|
||||
<span className="text-red-400">
|
||||
*
|
||||
</span>
|
||||
</label>
|
||||
<input
|
||||
id="email"
|
||||
type="email"
|
||||
value={data.email}
|
||||
onChange={(e) =>
|
||||
setField(
|
||||
'email',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
onBlur={() =>
|
||||
blurField('email')
|
||||
}
|
||||
placeholder="Seuemail@exemplo.com"
|
||||
autoComplete="email"
|
||||
className={fieldClass(
|
||||
'email',
|
||||
)}
|
||||
/>
|
||||
<ErrorMessage field="email" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
||||
<div className="space-y-2">
|
||||
<label
|
||||
htmlFor="phone"
|
||||
className="flex items-center gap-2 text-sm font-medium text-white/90"
|
||||
>
|
||||
<Phone className="h-4 w-4 text-white/60" />
|
||||
Telefone
|
||||
</label>
|
||||
<div className="flex overflow-hidden rounded-lg">
|
||||
<span className="flex items-center border border-r-0 border-white/20 bg-white/10 px-4 text-sm font-semibold">
|
||||
+258
|
||||
</span>
|
||||
<input
|
||||
id="phone"
|
||||
type="tel"
|
||||
inputMode="numeric"
|
||||
maxLength={11}
|
||||
value={data.phone}
|
||||
onChange={(e) =>
|
||||
setField(
|
||||
'phone',
|
||||
e.target
|
||||
.value,
|
||||
)
|
||||
}
|
||||
onBlur={() =>
|
||||
blurField(
|
||||
'phone',
|
||||
)
|
||||
}
|
||||
placeholder="85 884 7646"
|
||||
autoComplete="tel-national"
|
||||
className={`${fieldClass('phone')} rounded-l-none`}
|
||||
/>
|
||||
</div>
|
||||
<ErrorMessage field="phone" />
|
||||
{!errors.phone && (
|
||||
<p className="flex justify-between text-xs text-white/45">
|
||||
<span>
|
||||
Apenas os 9
|
||||
dígitos
|
||||
nacionais
|
||||
</span>
|
||||
<span>
|
||||
{
|
||||
extractPhoneMZ(
|
||||
data.phone,
|
||||
).length
|
||||
}
|
||||
/9
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label
|
||||
htmlFor="subject"
|
||||
className="flex items-center gap-2 text-sm font-medium text-white/90"
|
||||
>
|
||||
<FileText className="h-4 w-4 text-white/60" />
|
||||
Assunto
|
||||
<span className="text-red-400">
|
||||
*
|
||||
</span>
|
||||
</label>
|
||||
<input
|
||||
id="subject"
|
||||
value={data.subject}
|
||||
onChange={(e) =>
|
||||
setField(
|
||||
'subject',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
onBlur={() =>
|
||||
blurField('subject')
|
||||
}
|
||||
placeholder="Sobre o que deseja falar?"
|
||||
className={fieldClass(
|
||||
'subject',
|
||||
)}
|
||||
/>
|
||||
<ErrorMessage field="subject" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<label
|
||||
htmlFor="message"
|
||||
className="flex items-center gap-2 text-sm font-medium text-white/90"
|
||||
>
|
||||
<MessageSquare className="h-4 w-4 text-white/60" />
|
||||
Mensagem
|
||||
<span className="text-red-400">
|
||||
*
|
||||
</span>
|
||||
</label>
|
||||
<textarea
|
||||
id="message"
|
||||
rows={6}
|
||||
value={data.message}
|
||||
onChange={(e) =>
|
||||
setField(
|
||||
'message',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
onBlur={() =>
|
||||
blurField('message')
|
||||
}
|
||||
placeholder="Escreva sua mensagem aqui..."
|
||||
className={`${fieldClass('message')} resize-none`}
|
||||
/>
|
||||
<ErrorMessage field="message" />
|
||||
{data.message.length > 0 && (
|
||||
<p className="text-right text-xs text-white/40">
|
||||
{data.message.length}
|
||||
/2000
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="border-t border-white/10 pt-6">
|
||||
<div className="flex flex-col items-center gap-4">
|
||||
<button
|
||||
type="submit"
|
||||
disabled={
|
||||
processing ||
|
||||
!isValid
|
||||
}
|
||||
className="flex w-full items-center justify-center gap-2 rounded-lg bg-red-600 px-8 py-4 font-semibold text-white transition hover:-translate-y-0.5 hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-50 md:w-auto"
|
||||
>
|
||||
{processing ? (
|
||||
<>
|
||||
<Loader2 className="h-5 w-5 animate-spin" />
|
||||
Enviando...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Send className="h-5 w-5" />
|
||||
Enviar Mensagem
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
{sent && (
|
||||
<div
|
||||
role="status"
|
||||
className="flex items-center gap-2 rounded-lg border border-green-500/50 bg-green-500/20 px-4 py-2.5 text-green-300"
|
||||
>
|
||||
<CheckCircle2 className="h-5 w-5" />
|
||||
Mensagem enviada com
|
||||
sucesso!
|
||||
</div>
|
||||
)}
|
||||
{submitError && (
|
||||
<div
|
||||
role="alert"
|
||||
className="flex items-center gap-2 rounded-lg border border-red-500/50 bg-red-500/20 px-4 py-2.5 text-red-200"
|
||||
>
|
||||
<AlertCircle className="h-5 w-5 shrink-0" />
|
||||
{submitError}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="bg-[#1f1f1f] px-4 pb-4 sm:px-6 md:px-12">
|
||||
<div className="mx-auto max-w-6xl">
|
||||
<div className="mb-6 flex items-center gap-4">
|
||||
<div className="h-[1px] w-12 bg-red-600" />
|
||||
<span className="text-xs font-medium tracking-[0.25em] text-white uppercase">
|
||||
Localização Geográfica
|
||||
</span>
|
||||
</div>
|
||||
<div className="h-[350px] overflow-hidden rounded-2xl border border-white/10 contrast-125 grayscale transition-all duration-1000 hover:grayscale-0 sm:h-[450px]">
|
||||
<InstituitionalMaps />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Contact;
|
||||
Reference in New Issue
Block a user