feat: change pre-enrollment custom slug format to use single slash with pre-matricula- prefix
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 2m6s
Details
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 2m6s
Details
This commit is contained in:
parent
f927b85dc6
commit
26796290a2
|
|
@ -145,9 +145,7 @@ const PreMatricula: React.FC<Props> = ({ data, onConvert }) => {
|
||||||
|
|
||||||
const copyLink = () => {
|
const copyLink = () => {
|
||||||
if (!config) return;
|
if (!config) return;
|
||||||
const url = config.slug === 'pre-matricula'
|
const url = `${window.location.origin}/${config.slug}`;
|
||||||
? `${window.location.origin}/pre-matricula`
|
|
||||||
: `${window.location.origin}/pre-matricula/${config.slug}`;
|
|
||||||
navigator.clipboard.writeText(url);
|
navigator.clipboard.writeText(url);
|
||||||
setCopied(true);
|
setCopied(true);
|
||||||
setTimeout(() => setCopied(false), 2000);
|
setTimeout(() => setCopied(false), 2000);
|
||||||
|
|
@ -229,11 +227,17 @@ const PreMatricula: React.FC<Props> = ({ data, onConvert }) => {
|
||||||
value={config?.descricao || ''} onChange={e => setConfig(prev => prev ? { ...prev, descricao: e.target.value } : prev)} />
|
value={config?.descricao || ''} onChange={e => setConfig(prev => prev ? { ...prev, descricao: e.target.value } : prev)} />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[10px] font-bold text-slate-500 uppercase mb-1">Slug do Link (após /pre-matricula/)</label>
|
<label className="block text-[10px] font-bold text-slate-500 uppercase mb-1">Slug do Link Personalizado</label>
|
||||||
<div className="flex items-center bg-slate-50 border border-slate-200 rounded-lg overflow-hidden">
|
<div className="flex items-center bg-slate-50 border border-slate-200 rounded-lg overflow-hidden">
|
||||||
<span className="px-3 text-xs text-slate-400 font-mono whitespace-nowrap">/pre-matricula/</span>
|
<span className="px-3 text-xs text-slate-400 font-mono whitespace-nowrap">/pre-matricula-</span>
|
||||||
<input className="flex-1 px-2 py-3 bg-transparent focus:outline-none text-sm font-mono font-bold text-indigo-700"
|
<input className="flex-1 px-2 py-3 bg-transparent focus:outline-none text-sm font-mono font-bold text-indigo-700"
|
||||||
value={config?.slug || ''} onChange={e => setConfig(prev => prev ? { ...prev, slug: e.target.value.replace(/[^a-z0-9-]/g, '') } : prev)} />
|
value={config?.slug ? config.slug.replace(/^pre-matricula-?/, '') : ''}
|
||||||
|
onChange={e => {
|
||||||
|
const val = e.target.value.replace(/[^a-z0-9-]/g, '');
|
||||||
|
const newSlug = val ? `pre-matricula-${val}` : 'pre-matricula';
|
||||||
|
setConfig(prev => prev ? { ...prev, slug: newSlug } : prev);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -289,9 +293,9 @@ const PreMatricula: React.FC<Props> = ({ data, onConvert }) => {
|
||||||
<div className="bg-gradient-to-br from-indigo-50 to-violet-50 p-5 rounded-2xl border border-indigo-100">
|
<div className="bg-gradient-to-br from-indigo-50 to-violet-50 p-5 rounded-2xl border border-indigo-100">
|
||||||
<p className="text-[10px] font-black text-indigo-600 uppercase tracking-widest mb-2">Link Público</p>
|
<p className="text-[10px] font-black text-indigo-600 uppercase tracking-widest mb-2">Link Público</p>
|
||||||
<p className="text-xs font-mono text-indigo-800 break-all mb-3">
|
<p className="text-xs font-mono text-indigo-800 break-all mb-3">
|
||||||
{window.location.origin}/pre-matricula{config?.slug === 'pre-matricula' ? '' : `/${config?.slug}`}
|
{window.location.origin}/{config?.slug}
|
||||||
</p>
|
</p>
|
||||||
<a href={config?.slug === 'pre-matricula' ? '/pre-matricula' : `/pre-matricula/${config?.slug}`} target="_blank" rel="noopener noreferrer"
|
<a href={`/${config?.slug}`} target="_blank" rel="noopener noreferrer"
|
||||||
className="flex items-center gap-2 text-xs font-bold text-indigo-600 hover:text-indigo-700"
|
className="flex items-center gap-2 text-xs font-bold text-indigo-600 hover:text-indigo-700"
|
||||||
>
|
>
|
||||||
<ExternalLink size={14} /> Abrir Prévia
|
<ExternalLink size={14} /> Abrir Prévia
|
||||||
|
|
|
||||||
|
|
@ -3042,9 +3042,9 @@ async function startServer() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/pre-matricula/:slug', (req, res) => {
|
app.get('/pre-matricula-:slug', (req, res) => {
|
||||||
const { slug } = req.params;
|
const { slug } = req.params;
|
||||||
res.send(getPreMatriculaHTML(slug));
|
res.send(getPreMatriculaHTML('pre-matricula-' + slug));
|
||||||
});
|
});
|
||||||
|
|
||||||
// ===================================================
|
// ===================================================
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue