diff options
| author | Andrew Lee <andrew@alee14.me> | 2025-04-25 21:04:32 -0400 |
|---|---|---|
| committer | Andrew Lee <andrew@alee14.me> | 2025-04-25 21:04:32 -0400 |
| commit | b50e5415658c42c7102510a01dc66f5080febb9f (patch) | |
| tree | 0e23f7c6fe9b657ec56125c727cda01570f58a23 /app | |
| parent | b53a37e8b55c70cb6bd18e10e78820d90c3a78b9 (diff) | |
| download | alure-website-b50e5415658c42c7102510a01dc66f5080febb9f.tar.gz alure-website-b50e5415658c42c7102510a01dc66f5080febb9f.tar.bz2 alure-website-b50e5415658c42c7102510a01dc66f5080febb9f.zip | |
New country; New page; Update packages
Diffstat (limited to 'app')
| -rw-r--r-- | app/components/Navbar.js | 4 | ||||
| -rw-r--r-- | app/components/PSA.js | 2 | ||||
| -rw-r--r-- | app/components/psa.json | 6 | ||||
| -rw-r--r-- | app/countries.json | 25 | ||||
| -rw-r--r-- | app/enterprises/page.js | 133 | ||||
| -rw-r--r-- | app/travel-advisory/ListCountries.js | 2 | ||||
| -rw-r--r-- | app/updates/[slug]/page.js | 8 | ||||
| -rw-r--r-- | app/visas/ListCountries.js | 2 |
8 files changed, 162 insertions, 20 deletions
diff --git a/app/components/Navbar.js b/app/components/Navbar.js index 4c172da..3b42990 100644 --- a/app/components/Navbar.js +++ b/app/components/Navbar.js @@ -27,12 +27,12 @@ const Navbar = () => { {[ ['Home', '/'], ['Updates', '/updates'], - // ['Services', '/services'], + ['Enterprises', '/enterprises'], ['Travel Advisory', '/travel-advisory'], ['Visas', '/visas'], ['Immigration', '/immigration'], ].map(([title, url]) => ( - <li key="links"> + <li key={title}> <Link href={url} className="transition duration-150 ease-out hover:ease-in block py-2 pl-3 pr-4 rounded md:border-0 md:p-0 text-white md:hover:text-blue-500 hover:bg-gray-700 hover:text-white md:hover:bg-transparent" onClick={() => setNavbar(!navbar)}> {title} </Link> diff --git a/app/components/PSA.js b/app/components/PSA.js index f5193a8..da5f35b 100644 --- a/app/components/PSA.js +++ b/app/components/PSA.js @@ -1,4 +1,4 @@ -import psaMessage from './psa.json' assert { type: 'json' }; +import psaMessage from './psa.json' with { type: 'json' }; import Link from "next/link"; const PSA = () => { diff --git a/app/components/psa.json b/app/components/psa.json index 08fac73..691070b 100644 --- a/app/components/psa.json +++ b/app/components/psa.json @@ -1,5 +1,5 @@ { - "important": 0, - "announcement": "Want to become an Alure Regions resident? Check out this post for more information.", - "link": "/updates/announcing-immigration" + "important": 1, + "announcement": "Internal businesses now require to register with the government.", + "link": "/updates/enterprises-registering" } diff --git a/app/countries.json b/app/countries.json index 588a1e6..d783394 100644 --- a/app/countries.json +++ b/app/countries.json @@ -45,6 +45,19 @@ "history": [] }, { + "name": "Basuran Federal Union", + "short": "BFU", + "url": "basuran", + "visa": true, + "visaInfo": [], + "image": "/countries/basuran.webp", + "danger": 3, + "settlements": [], + "history": [ + "April 2025: Internal civil war between states." + ] + }, + { "name": "The Republic of Bohemia", "short": "BHM", "url": "bohemia", @@ -73,11 +86,9 @@ "visa": true, "visaInfo": [], "image": "/countries/doodadsandgizmos.webp", - "danger": 3, + "danger": 0, "settlements": [], - "history": [ - "March 2025: Gizmo City announced that they will nuke Sorena. Their citizens responded with a revolution." - ] + "history": [] }, { "name": "Eagle City", @@ -262,11 +273,9 @@ "visa": true, "visaInfo": [], "image": "/countries/sorena.webp", - "danger": 3, + "danger": 0, "settlements": [], - "history": [ - "March 2025: Internal turnoil in Sorena." - ] + "history": [] }, { "name": "Sulópolis", diff --git a/app/enterprises/page.js b/app/enterprises/page.js new file mode 100644 index 0000000..7d8ce02 --- /dev/null +++ b/app/enterprises/page.js @@ -0,0 +1,133 @@ +import Header from "../components/Header"; +import { google } from "googleapis"; + +const auth = new google.auth.GoogleAuth({ + credentials: { + client_email: process.env.GOOGLE_CLIENT_EMAIL, + private_key: process.env.GOOGLE_PRIVATE_KEY.replace(/\\n/g, '\n'), + project_id: process.env.GOOGLE_PROJECT_ID, + }, + scopes: ['https://www.googleapis.com/auth/spreadsheets.readonly'], +}); + + +async function fetchSheetData(spreadsheetId, range) { + const client = await auth.getClient(); + const sheets = google.sheets('v4'); + const response = await sheets.spreadsheets.values.get({ + auth: client, + spreadsheetId, + range, + }); + + const rows = response.data.values; + + // Define the headers + const headers = [ + 'CompanyID', + 'Businesses', + 'ParentCompany', + 'Type', + 'Owner', + 'Status', + 'Notes' + ]; + + // Map rows to objects + const formattedData = rows.slice(1).map(row => { + const obj = {}; + headers.forEach((header, index) => { + let value = row[index] || ''; // Assign empty string if value is missing + if (header === 'Businesses') { + value = value.includes('\n') ? value.split('\n') : [value]; // Split into array if multiple businesses + } + obj[header] = value; + }); + return obj; + }); + + return Object.values( + formattedData.reduce((acc, company) => { + const parent = company.ParentCompany; + if (!acc[parent]) { + acc[parent] = {...company, Businesses: [...company.Businesses]}; + } else { + acc[parent].Businesses = [...acc[parent].Businesses, ...company.Businesses]; + } + return acc; + }, {}) + ); +} + + +export const metadata = { + title: 'Enterprises', + description: 'Registered enterprises in the Alure Regions', +} + +export default async function Services() { + const response = await fetchSheetData('1VWt21lvbqBRmpZPeC87ZXJphibMEATFp48PPW457q38', 'A1:G32'); + + return ( + <main className="flex flex-col"> + <Header title={metadata.title} description={metadata.description} /> + <div className="sm:px-40 px-10 py-3 space-y-3 bg-zinc-800"> + <div className="bg-gray-950 p-5 rounded-2xl"> + <h1 className="text-2xl font-medium">Want to start a business?</h1> + <p>Register with the Alure Regions government in order to operate a company.</p> + </div> + {/*<form> + <label htmlFor="default-search" + className="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white">Search</label> + <div className="relative"> + <div className="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none"> + <svg className="w-4 h-4 text-gray-500 dark:text-gray-400" aria-hidden="true" + xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"> + <path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" + strokeWidth="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/> + </svg> + </div> + <input type="search" id="default-search" + className="block w-full p-4 ps-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" + placeholder="Search companies..." required/> + </div> + </form>*/} + + <div className="grid grid-cols-1 sm:grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4"> + { + response.map((company) => { + return ( + <div key={company.ParentCompany} className="bg-gray-950 p-5 rounded-2xl"> + <h1 className="text-3xl py-1.5">{company.ParentCompany}</h1> + <p>Business ID: {company.CompanyID} • Owner: {company.Owner}</p> + <p>Type: {company.Type}</p> + <p>Status: Operational</p> + <h2 className="text-2xl py-1.5">Businesses</h2> + <ul> + { + company.Businesses.map((business) => { + return ( + <li key={business}> + {business} + </li> + ) + }) + } + </ul> + { + company.Notes && ( + <> + <h2 className="text-2xl py-1.5">Notes:</h2> + <p>{company.Notes}</p> + </> + ) + } + </div> + ) + }) + } + </div> + </div> + </main> + ) +} diff --git a/app/travel-advisory/ListCountries.js b/app/travel-advisory/ListCountries.js index 7e59216..4248cd1 100644 --- a/app/travel-advisory/ListCountries.js +++ b/app/travel-advisory/ListCountries.js @@ -1,5 +1,5 @@ "use client" -import countriesData from '@/app/countries.json' assert { type: 'json' }; +import countriesData from '@/app/countries.json' with { type: 'json' }; import HistoryModal from "@/app/travel-advisory/HistoryModal"; import { useState } from "react"; diff --git a/app/updates/[slug]/page.js b/app/updates/[slug]/page.js index 555caa7..e5feabd 100644 --- a/app/updates/[slug]/page.js +++ b/app/updates/[slug]/page.js @@ -11,8 +11,8 @@ const getPostContent = (slug) => { return matter(content); } -export function generateMetadata(props) { - const slug = props.params.slug; +export async function generateMetadata(props) { + const slug = (await props.params).slug; const post = getPostContent(slug); return { @@ -28,8 +28,8 @@ export const generateStaticParams = async () => { })) } -export default function PostPage(props) { - const slug = props.params.slug; +export default async function PostPage(props) { + const slug = (await props.params).slug; const post = getPostContent(slug); return ( <main> diff --git a/app/visas/ListCountries.js b/app/visas/ListCountries.js index 1e926cf..bd15b9a 100644 --- a/app/visas/ListCountries.js +++ b/app/visas/ListCountries.js @@ -1,5 +1,5 @@ "use client" -import countriesData from '@/app/countries.json' assert { type: 'json' }; +import countriesData from '@/app/countries.json' with { type: 'json' }; import HistoryModal from "@/app/visas/HistoryModal"; import { useState } from "react"; |
