From b50e5415658c42c7102510a01dc66f5080febb9f Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Fri, 25 Apr 2025 21:04:32 -0400 Subject: New country; New page; Update packages --- app/components/Navbar.js | 4 +- app/components/PSA.js | 2 +- app/components/psa.json | 6 +- app/countries.json | 25 ++++--- app/enterprises/page.js | 133 +++++++++++++++++++++++++++++++++++ app/travel-advisory/ListCountries.js | 2 +- app/updates/[slug]/page.js | 8 +-- app/visas/ListCountries.js | 2 +- bun.lockb | Bin 207385 -> 256603 bytes package.json | 19 ++--- posts/enterprises-registering.md | 11 +++ public/countries/basuran.webp | Bin 0 -> 200066 bytes 12 files changed, 183 insertions(+), 29 deletions(-) create mode 100644 app/enterprises/page.js create mode 100644 posts/enterprises-registering.md create mode 100644 public/countries/basuran.webp 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]) => ( -
  • +
  • setNavbar(!navbar)}> {title} 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 @@ -44,6 +44,19 @@ "settlements": [], "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", @@ -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 ( +
    +
    +
    +
    +

    Want to start a business?

    +

    Register with the Alure Regions government in order to operate a company.

    +
    + {/*
    + +
    +
    + +
    + +
    +
    */} + +
    + { + response.map((company) => { + return ( +
    +

    {company.ParentCompany}

    +

    Business ID: {company.CompanyID} • Owner: {company.Owner}

    +

    Type: {company.Type}

    +

    Status: Operational

    +

    Businesses

    +
      + { + company.Businesses.map((business) => { + return ( +
    • + {business} +
    • + ) + }) + } +
    + { + company.Notes && ( + <> +

    Notes:

    +

    {company.Notes}

    + + ) + } +
    + ) + }) + } +
    +
    +
    + ) +} 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 (
    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"; diff --git a/bun.lockb b/bun.lockb index b33eb89..abb013c 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index a0478ec..e2107cf 100644 --- a/package.json +++ b/package.json @@ -3,23 +3,24 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev --turbo", + "dev": "next dev --turbopack", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { - "autoprefixer": "^10.4.20", - "date-fns": "^3.6.0", + "autoprefixer": "^10.4.21", + "date-fns": "^4.1.0", "eslint": "^9.9.0", - "eslint-config-next": "^14.2.5", + "eslint-config-next": "15.3.1", + "googleapis": "^148.0.0", "gray-matter": "^4.0.3", - "markdown-to-jsx": "^7.4.7", - "next": "^14.2.5", + "markdown-to-jsx": "^7.7.6", + "next": "15.3.1", "postcss": "^8.4.41", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "tailwindcss": "^3.4.10" + "react": "19.1.0", + "react-dom": "19.1.0", + "tailwindcss": "3.4.17" }, "devDependencies": { "@tailwindcss/typography": "^0.5.10" diff --git a/posts/enterprises-registering.md b/posts/enterprises-registering.md new file mode 100644 index 0000000..1a2560e --- /dev/null +++ b/posts/enterprises-registering.md @@ -0,0 +1,11 @@ +--- +title: Internal Enterprises Now Requires Registering +description: Enterprises originating in the Alure Regions now require to register with the government. +author: Government of the Alure Regions +date: '2025-04-25' +tags: ['announcement', 'entreprise'] +--- +# Mandatory Internal Business Registration for the Alure Regions +Starting on April 25, 2025, all businesses that are originating within the Alure Regions will be required to register to the "Alurian Company Database". This is to ensure that the businesses within the Alure Regions is legitimate, and have issued a verified business number. + +[Check out the Alure Regions Entreprises Database here.](/enterprises) diff --git a/public/countries/basuran.webp b/public/countries/basuran.webp new file mode 100644 index 0000000..be9f9d3 Binary files /dev/null and b/public/countries/basuran.webp differ -- cgit v1.2.3