SPB Git

Repository Public

page.tsx 2.6 KB 71 lines tsx

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : KA Maps Engine8 * File             : sdk/web/tests/next-app/app/page.tsx9 * Module           : sdk10 * Repository       : https://git.spboucher.ai/ka-maps-engine11 * Created          : 2026-12-0112 * Last Modified    : 2026-12-0113 *14 * Author           : Simon-Pierre Boucher15 * Position         : Professor of Finance16 * Institution      : Université du Québec en Outaouais (UQO)17 * Organization     : SP Boucher18 * Website          : https://spboucher.ai19 * Git              : https://git.spboucher.ai20 *21 * Preferred Contact: support@spboucher.ai22 * Development      : dev@spboucher.ai23 * Support          : support@spboucher.ai24 * Security/Admin   : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License          : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142// Composant serveur : importe @ka/maps côté serveur (sans toucher à window) et utilise geo.search43// pendant le rendu ; la carte elle-même est un composant client.44import { connection } from 'next/server';45import { geo, VERSION } from '@ka/maps';46import MapClient from './MapClient';4748export default async function Page() {49  await connection(); // rendu dynamique (nonce de CSP par requête)50  let label = 'recherche indisponible';51  let center: [number, number] = [-73.5674, 45.5019];52  try {53    const r = await geo.search('1000 rue Sherbrooke Est Montréal', { limit: 1 });54    if (r.results[0]) {55      label = r.results[0].label;56      center = [r.results[0].lon, r.results[0].lat];57    }58  } catch {59    /* service injoignable : la page s'affiche quand même */60  }61  return (62    <main>63      <header>64        <h1>KA Maps {VERSION} — Next.js 16</h1>65        <p data-testid="server-geo">Adresse trouvée côté serveur : {label}</p>66      </header>67      <MapClient center={center} />68    </main>69  );70}71
Files main
Menu

Theme