Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions src/components/innovision/AmbassadorCodeDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ async function copyText(text: string, fallback: HTMLElement | null): Promise<boo

/**
* GET MY CODE, opened from the home page's Campus Ambassador section. Any signed-in student can get a code: the first
* time, they confirm their college and the code is created. Then it shows their permanent CA code with a share link
* (/?ref=CODE pre-fills the registration form) and a WhatsApp share. Ambassadors see only their code: counts live in
* the admin dashboard's AMBASSADORS tab.
* time, they confirm their college and the code is created. Then it shows their permanent CA code and a share link
* (/?ref=CODE pre-fills the registration form), each with a copy button. Ambassadors see only their code: counts live
* in the admin dashboard's AMBASSADORS tab.
*/
export default function AmbassadorCodeDialog({ state, formUrl, onClose, onRetry, onCreate, onLogout }: AmbassadorCodeDialogProps) {
const ref = useRef<HTMLDivElement>(null);
Expand All @@ -77,7 +77,6 @@ export default function AmbassadorCodeDialog({ state, formUrl, onClose, onRetry,

const shown = state.kind === 'code' ? formatReferralCode(state.code) : '';
const link = state.kind === 'code' ? `${SITE_URL}/?ref=${encodeURIComponent(state.code)}` : '';
const shareText = `Register for INNOVISION 2026 at NIT Rourkela with my campus ambassador code ${shown}: ${link}`;
const copy = async (what: 'code' | 'link') => {
const ok = await copyText(what === 'code' ? shown : link, (what === 'code' ? codeRef : linkRef).current);
setCopied(ok ? what : 'manual');
Expand Down Expand Up @@ -157,14 +156,9 @@ export default function AmbassadorCodeDialog({ state, formUrl, onClose, onRetry,
<span style={{ fontSize: '12px', color: 'rgba(236,232,223,0.55)' }}>Opening it fills your code in for them when they register.</span>
</div>
{copied === 'manual' && <p role="status" style={{ ...muted, color: GOLD }}>Copying isn&apos;t allowed here: it&apos;s selected, so copy it by hand.</p>}
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '10px' }}>
<a href={`https://wa.me/?text=${encodeURIComponent(shareText)}`} target="_blank" rel="noopener noreferrer" style={{ ...primaryBtn, flex: '1 1 180px' }}>
SHARE ON WHATSAPP
</a>
<button type="button" onClick={() => void copy('link')} style={{ ...ghostBtn, flex: '1 1 140px' }}>
{copied === 'link' ? 'LINK COPIED' : 'COPY LINK'}
</button>
</div>
<button type="button" onClick={() => void copy('link')} style={primaryBtn}>
{copied === 'link' ? 'LINK COPIED' : 'COPY LINK'}
</button>
<p style={{ ...muted, fontSize: '12px', overflowWrap: 'anywhere' }}>Signed in as {state.email}.</p>
</>
)}
Expand Down
6 changes: 3 additions & 3 deletions src/config/ambassador.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
*
* AMBASSADOR_FORM_URL is the organisers' Google Form that APPLY opens. It only collects applications for the team's own
* records: GET MY CODE gives any signed-in student their code whether or not they filled it in, and nothing reads the
* responses. PLACEHOLDER: while it is empty, APPLY shows "APPLICATIONS OPEN SOON" (disabled); GET MY CODE works either
* way. When the organisers share the form, paste its link here (e.g. 'https://forms.gle/...').
* responses. Set it to '' to show "APPLICATIONS OPEN SOON" (disabled) instead; GET MY CODE works either way.
*/
export const AMBASSADOR_FORM_URL = '';
export const AMBASSADOR_FORM_URL =
'https://docs.google.com/forms/d/e/1FAIpQLSeYhrbZ0vrAdlSyShN7FUV_MfxNogBVWcKmPzcxzORCYcBMFQ/viewform';

/** Home page section id (data-sec) and route: #/ambassador scrolls there. */
export const AMBASSADOR_SECTION = 'ambassador';
Loading