Travel advisory, added visa page

This commit is contained in:
Andrew Lee 2025-01-10 09:32:09 -05:00
parent 605bc321bb
commit 35fb56c3bf
Signed by: andrew
SSH key fingerprint: SHA256:bbGg1DYG5CuKl2jo1DqzvUsaTeyvhM3tjCsej5lYMg4
7 changed files with 456 additions and 293 deletions

View file

@ -29,6 +29,7 @@ const Navbar = () => {
['Updates', '/updates'], ['Updates', '/updates'],
['Services', '/services'], ['Services', '/services'],
['Travel Advisory', '/travel-advisory'], ['Travel Advisory', '/travel-advisory'],
['Visas', '/visas'],
['Immigration', '/immigration'], ['Immigration', '/immigration'],
].map(([title, url]) => ( ].map(([title, url]) => (
<li key="links"> <li key="links">

347
app/countries.json Normal file
View file

@ -0,0 +1,347 @@
{
"countries": [
{
"name": "Anatoli",
"short": "ANT",
"url": "anatoli",
"visa": false,
"visaInfo": [],
"image": "/countries/anatoli.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Auckland",
"short": "AAB",
"url": "auckland",
"visa": true,
"visaInfo": [],
"image": "/countries/auckland.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "The Aura Regions",
"short": "ARA",
"url": "auraregions",
"visa": false,
"visaInfo": [],
"image": "/countries/auraregions.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Banatown",
"short": "BAT",
"url": "banatown",
"visa": true,
"visaInfo": [],
"image": "/countries/banatown.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Country Warp",
"short": "COW",
"url": "countrywarp",
"visa": true,
"visaInfo": [],
"image": "/countries/countrywarp.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Cypress",
"short": "CYP",
"url": "cypress",
"visa": true,
"visaInfo": [],
"image": "/countries/cypress.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "The Federation of Doodads and Gizmos",
"short": "FDG",
"url": "doodadsandgizmos",
"visa": true,
"visaInfo": [],
"image": "/countries/doodadsandgizmos.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Eagle City",
"short": "EGL",
"url": "eaglecity",
"visa": true,
"visaInfo": [],
"image": "/countries/eaglecity.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Fegal",
"short": "FGL",
"url": "fegal",
"visa": false,
"visaInfo": [],
"image": "/countries/fegal.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Halcandra",
"short": "HAL",
"url": "halcandra",
"visa": true,
"visaInfo": [],
"image": "/countries/halcandra.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Inkytown",
"short": "INK",
"url": "inkytown",
"visa": false,
"visaInfo": [],
"image": "/countries/inkytown.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "The Kemonomimi Republic",
"short": "KRP",
"url": "kemonomimi-republic",
"visa": false,
"visaInfo": [],
"image": "/countries/kemonomimi.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "The Knowle Regions",
"short": "KWL",
"url": "knowle-regions",
"visa": true,
"visaInfo": [],
"image": "/countries/knowleregions.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "landrepeatland",
"short": "LRL",
"url": "landrepeatland",
"visa": true,
"visaInfo": [],
"image": "/countries/landrepeatland.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Lion Land",
"short": "LLI",
"url": "lionland",
"visa": false,
"visaInfo": [],
"image": "/countries/lionland.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Mart's Extraordinarily Sublime State",
"short": "MES",
"url": "mess",
"visa": false,
"visaInfo": [],
"image": "/countries/mess.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Mojave",
"short": "MOJ",
"url": "mojave",
"visa": false,
"visaInfo": [],
"image": "/countries/mojave.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "The Open Republic",
"short": "ORP",
"url": "open-republic",
"visa": false,
"visaInfo": [],
"image": "/countries/openrepublic.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Ownage",
"short": "OWN",
"url": "ownage",
"visa": true,
"visaInfo": [],
"image": "/countries/ownage.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "PLC",
"short": "PLC",
"url": "plc",
"visa": true,
"visaInfo": [],
"image": "/countries/plc.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Plutonia Imperium",
"short": "PLI",
"url": "plutonia-imperium",
"visa": true,
"visaInfo": [],
"image": "/countries/plutoniaimperium.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "The Republic of Québec",
"short": "ROQ",
"url": "republic-of-quebec",
"visa": true,
"visaInfo": [],
"image": "/countries/quebec.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Solstan Federation",
"short": "SFR",
"url": "solstice",
"visa": true,
"visaInfo": [
"January 10th 2025: Solstice citizens will be required to have a visa to enter the Alure Regions. In addition, they will need a second form of ID and all ePassport+ gates will be disabled for Solstice citizens."
],
"image": "/countries/solstice.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Sulópolis",
"short": "SLP",
"url": "sulopolis",
"visa": false,
"visaInfo": [],
"image": "/countries/sulopolis.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Summasol",
"short": "SMS",
"url": "summasol",
"visa": true,
"visaInfo": [],
"image": "/countries/summasol.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "TAY",
"short": "TAY",
"url": "tay",
"visa": false,
"visaInfo": [],
"image": "/countries/tay.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Union of Soviet Sovereign Republics",
"short": "SUN",
"url": "ussr",
"visa": true,
"visaInfo": [],
"image": "/countries/ussr.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Veronian Controlled Territories",
"short": "VCT",
"url": "veronian-controlled-territories",
"visa": true,
"visaInfo": [],
"image": "/countries/vct.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "Vyxalla",
"short": "VYX",
"url": "vyxalla",
"visa": true,
"visaInfo": [],
"image": "/countries/vyxalla.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "The Republic of Whale City",
"short": "WCI",
"url": "whale-city",
"visa": false,
"visaInfo": [],
"image": "/countries/whalecity.webp",
"danger": 0,
"settlements": [],
"history": []
},
{
"name": "The Republic of Yavno",
"short": "YNO",
"url": "yavno",
"visa": false,
"visaInfo": [],
"image": "/countries/yavno.webp",
"danger": 0,
"settlements": [],
"history": []
}
]
}

View file

@ -1,5 +1,5 @@
"use client" "use client"
import countriesData from '@/app/travel-advisory/countries.json' assert { type: 'json' }; import countriesData from '@/app/countries.json' assert { type: 'json' };
import HistoryModal from "@/app/travel-advisory/HistoryModal"; import HistoryModal from "@/app/travel-advisory/HistoryModal";
import { useState } from "react"; import { useState } from "react";

View file

@ -1,292 +0,0 @@
{
"countries": [
{
"name": "Anatoli",
"short": "ANT",
"url": "anatoli",
"danger": 0,
"image": "/countries/anatoli.webp",
"settlements": [],
"history": []
},
{
"name": "Auckland",
"short": "AAB",
"url": "auckland",
"danger": 0,
"image": "/countries/auckland.webp",
"settlements": [],
"history": []
},
{
"name": "The Aura Regions",
"short": "ARA",
"url": "auraregions",
"danger": 0,
"image": "/countries/auraregions.webp",
"settlements": [],
"history": []
},
{
"name": "Banatown",
"short": "BAT",
"url": "banatown",
"danger": 0,
"image": "/countries/banatown.webp",
"settlements": [],
"history": []
},
{
"name": "Country Warp",
"short": "COW",
"url": "countrywarp",
"danger": 0,
"image": "/countries/countrywarp.webp",
"settlements": [],
"history": []
},
{
"name": "Cypress",
"short": "CYP",
"url": "cypress",
"danger": 0,
"image": "/countries/cypress.webp",
"settlements": [],
"history": []
},
{
"name": "The Federation of Doodads and Gizmos",
"short": "FDG",
"url": "doodadsandgizmos",
"danger": 0,
"image": "/countries/doodadsandgizmos.webp",
"settlements": [],
"history": []
},
{
"name": "Eagle City",
"short": "EGL",
"url": "eaglecity",
"danger": 0,
"image": "/countries/eaglecity.webp",
"settlements": [],
"history": []
},
{
"name": "Fegal",
"short": "FGL",
"url": "fegal",
"danger": 0,
"image": "/countries/fegal.webp",
"settlements": [],
"history": []
},
{
"name": "Halcandra",
"short": "HAL",
"url": "halcandra",
"danger": 0,
"image": "/countries/halcandra.webp",
"settlements": [],
"history": []
},
{
"name": "Inkytown",
"short": "INK",
"url": "inkytown",
"danger": 0,
"image": "/countries/inkytown.webp",
"settlements": [],
"history": []
},
{
"name": "The Kemonomimi Republic",
"short": "KRP",
"url": "kemonomimi-republic",
"danger": 0,
"image": "/countries/kemonomimi.webp",
"settlements": [],
"history": []
},
{
"name": "The Knowle Regions",
"short": "KWL",
"url": "knowle-regions",
"danger": 0,
"image": "/countries/knowleregions.webp",
"settlements": [],
"history": []
},
{
"name": "landrepeatland",
"short": "LRL",
"url": "landrepeatland",
"danger": 0,
"image": "/countries/landrepeatland.webp",
"settlements": [],
"history": []
},
{
"name": "Lion Land",
"short": "LLI",
"url": "lionland",
"danger": 0,
"image": "/countries/lionland.webp",
"settlements": [],
"history": []
},
{
"name": "Mart's Extraordinarily Sublime State",
"short": "MES",
"url": "mess",
"danger": 0,
"image": "/countries/mess.webp",
"settlements": [],
"history": []
},
{
"name": "Mojave",
"short": "MOJ",
"url": "mojave",
"danger": 0,
"image": "/countries/mojave.webp",
"settlements": [],
"history": []
},
{
"name": "The Open Republic",
"short": "ORP",
"url": "open-republic",
"danger": 0,
"image": "/countries/openrepublic.webp",
"settlements": [],
"history": []
},
{
"name": "Ownage",
"short": "OWN",
"url": "ownage",
"danger": 0,
"image": "/countries/ownage.webp",
"settlements": [],
"history": []
},
{
"name": "PLC",
"short": "PLC",
"url": "plc",
"danger": 0,
"image": "/countries/plc.webp",
"settlements": [],
"history": []
},
{
"name": "Plutonia Imperium",
"short": "PLI",
"url": "plutonia-imperium",
"danger": 0,
"image": "/countries/plutoniaimperium.webp",
"settlements": [],
"history": []
},
{
"name": "The Republic of Québec",
"short": "ROQ",
"url": "republic-of-quebec",
"danger": 0,
"image": "/countries/quebec.webp",
"settlements": [],
"history": []
},
{
"name": "Solstan Federation",
"short": "SFR",
"url": "solstice",
"danger": 0,
"image": "/countries/solstice.webp",
"settlements": [
{
"name": "Firefly",
"danger": 2
}
],
"history": [
"Nov 17, 2024: Violent protest at the capital of the Solstan Federation"
]
},
{
"name": "Sulópolis",
"short": "SLP",
"url": "sulopolis",
"danger": 0,
"image": "/countries/sulopolis.webp",
"settlements": [],
"history": []
},
{
"name": "Summasol",
"short": "SMS",
"url": "summasol",
"danger": 0,
"image": "/countries/summasol.webp",
"settlements": [],
"history": []
},
{
"name": "TAY",
"short": "TAY",
"url": "tay",
"danger": 0,
"image": "/countries/tay.webp",
"settlements": [],
"history": []
},
{
"name": "Union of Soviet Sovereign Republics",
"short": "SUN",
"url": "ussr",
"danger": 0,
"image": "/countries/ussr.webp",
"settlements": [],
"history": []
},
{
"name": "Veronian Controlled Territories",
"short": "VCT",
"url": "veronian-controlled-territories",
"danger": 0,
"image": "/countries/vct.webp",
"settlements": [],
"history": []
},
{
"name": "Vyxalla",
"short": "VYX",
"url": "vyxalla",
"danger": 0,
"image": "/countries/vyxalla.webp",
"settlements": [],
"history": []
},
{
"name": "The Republic of Whale City",
"short": "WCI",
"url": "whale-city",
"danger": 0,
"image": "/countries/whalecity.webp",
"settlements": [],
"history": []
},
{
"name": "The Republic of Yavno",
"short": "YNO",
"url": "yavno",
"danger": 0,
"image": "/countries/yavno.webp",
"settlements": [],
"history": []
}
]
}

40
app/visas/HistoryModal.js Normal file
View file

@ -0,0 +1,40 @@
const HistoryModal = ({ isVisible, onClose, countries, dangerLevel, visaInfo }) => {
if (!isVisible) return null;
const handleClose = (e) => {
if(e.target.id === 'wrapper') onClose();
}
let historyList;
if (visaInfo && visaInfo.length > 0) {
historyList = visaInfo.map((event, index) => {
return (
<li key={index}>{event}</li>
)
})
} else {
historyList = <li>No additional information for {countries}.</li>;
}
return (
<div id="wrapper" className="fixed inset-0 bg bg-opacity-25 backdrop-blur-sm flex justify-center items-center" onClick={handleClose}>
<div className="w-[700px]">
<div className="flex flex-col">
<div className="bg-zinc-800 p-5 rounded-lg border border-gray-700">
<div className="divide-y space-y-3">
<div>
<h1 className="font-medium text-3xl">{countries}</h1>
<h2 className="font-medium text-xl">{dangerLevel}</h2>
</div>
<div>
<h1 className="font-medium text-2xl pt-3">Additional Information</h1>
<ul>{historyList}</ul>
</div>
</div>
</div>
</div>
</div>
</div>
)
}
export default HistoryModal;

View file

@ -0,0 +1,51 @@
"use client"
import countriesData from '@/app/countries.json' assert { type: 'json' };
import HistoryModal from "@/app/visas/HistoryModal";
import { useState } from "react";
export function getDangerLevel(danger, override) {
if (danger === 0 && override !== undefined) {
danger = override;
}
let dangerLevel;
switch (danger) {
case false:
dangerLevel = "Visa not required"
break;
case true:
dangerLevel = "Visa required"
break;
}
return dangerLevel;
}
export function Countries(){
// eslint-disable-next-line react-hooks/rules-of-hooks
const [showModal, setShowModal] = useState(false);
const [selectedCountry, setSelectedCountry] = useState(null);
const [selectedDangerLevel, setSelectedDangerLevel] = useState(null);
const [selectedCountryHistory, setSelectedCountryHistory] = useState(null);
const countries = countriesData.countries;
return countries.map((country) => {
let dangerLevel = getDangerLevel(country.visa);
return (
<div key={country.name} id={country.url} className="bg-center bg-no-repeat bg-[image:var(--image-url)] bg-gray-500 bg-blend-multiply" style={{'--image-url': `url(${country.image})`}} >
<div className="sm:px-40 px-10 py-10 space-y-3">
<h1 className="font-medium md:text-5xl text-3xl">{country.name}</h1>
<h2 className="text-lg">{dangerLevel}</h2>
<button className="transition duration-200 ease-in-out px-4 py-2 font-medium rounded-full bg-blue-600 hover:bg-blue-700 active:bg-blue-800" onClick={()=> {
setSelectedCountry(country.name);
setSelectedDangerLevel(dangerLevel)
setSelectedCountryHistory(country.visaInfo)
setShowModal(true)
}}>Information</button>
</div>
<HistoryModal isVisible={showModal} onClose={() => setShowModal(false)} countries={selectedCountry} dangerLevel={selectedDangerLevel} visaInfo={selectedCountryHistory} />
</div>
)
})
}

16
app/visas/page.js Normal file
View file

@ -0,0 +1,16 @@
import { Countries } from "./ListCountries";
import Header from "../components/Header";
export const metadata = {
title: 'Visas',
description: 'Information whether a country is required a visa or not. ',
}
export default async function TravelAdvisory(){
return (
<main className="flex flex-col">
<Header title={metadata.title} description={metadata.description} />
<Countries />
</main>
)
}