From 649b1d4328a7ffc31cb5e9d47e2b3ddefcc66f16 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 24 Jul 2023 20:27:10 -0400 Subject: Initial rewrite to astro --- src/components/Navbar.jsx | 41 ++++ src/components/PSA.astro | 40 ++++ src/components/psa.json | 5 + src/components/travel-advisory/HistoryModal.jsx | 40 ++++ src/components/travel-advisory/ListCountries.jsx | 65 ++++++ src/components/travel-advisory/countries.json | 253 +++++++++++++++++++++++ src/env.d.ts | 2 + src/layouts/Layout.astro | 31 +++ src/pages/index.astro | 62 ++++++ src/pages/travel-advisory.astro | 32 +++ src/posts/outbreak.md | 15 ++ src/posts/website-launched.md | 13 ++ src/styles/globals.css | 20 ++ 13 files changed, 619 insertions(+) create mode 100644 src/components/Navbar.jsx create mode 100644 src/components/PSA.astro create mode 100644 src/components/psa.json create mode 100644 src/components/travel-advisory/HistoryModal.jsx create mode 100644 src/components/travel-advisory/ListCountries.jsx create mode 100644 src/components/travel-advisory/countries.json create mode 100644 src/env.d.ts create mode 100644 src/layouts/Layout.astro create mode 100644 src/pages/index.astro create mode 100644 src/pages/travel-advisory.astro create mode 100644 src/posts/outbreak.md create mode 100644 src/posts/website-launched.md create mode 100644 src/styles/globals.css (limited to 'src') diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx new file mode 100644 index 0000000..63b2010 --- /dev/null +++ b/src/components/Navbar.jsx @@ -0,0 +1,41 @@ +import { useState } from "preact/hooks"; +export default function Navbar(){ + const [navbar, setNavbar] = useState(false); + return ( + + +) +} diff --git a/src/components/PSA.astro b/src/components/PSA.astro new file mode 100644 index 0000000..ad2bcdf --- /dev/null +++ b/src/components/PSA.astro @@ -0,0 +1,40 @@ +--- +import psaMessage from "./psa.json"; +let defaultStyle = "flex flex-row md:px-40 sm:px-30 sm:py-0.5 p-3 space-x-2"; +let styleImportant; +let important; +switch (psaMessage.important) { + case 0: + styleImportant = "hidden" + defaultStyle += ' ' + styleImportant + break; + case 1: + important = "Latest News:" + styleImportant = "bg-zinc-700" + defaultStyle += ' ' + styleImportant + break; + case 2: + important = "WARNING!" + styleImportant = "bg-yellow-700" + defaultStyle += ' ' + styleImportant + break; + case 3: + important = "EMERGENCY!" + styleImportant = "bg-red-800" + defaultStyle += ' ' + styleImportant + break; +} +--- + +
+

{important}

+
+

{psaMessage.announcement}

+

+ {psaMessage.link && ( + + Learn more ↗ + + )}

+
+
diff --git a/src/components/psa.json b/src/components/psa.json new file mode 100644 index 0000000..d0d28ce --- /dev/null +++ b/src/components/psa.json @@ -0,0 +1,5 @@ +{ + "important": 0, + "announcement": "No important announcements at this time.", + "link": "/travel-advisory" +} diff --git a/src/components/travel-advisory/HistoryModal.jsx b/src/components/travel-advisory/HistoryModal.jsx new file mode 100644 index 0000000..6449a6a --- /dev/null +++ b/src/components/travel-advisory/HistoryModal.jsx @@ -0,0 +1,40 @@ +const HistoryModal = ({ isVisible, onClose, countries, dangerLevel, history }) => { + if (!isVisible) return null; + const handleClose = (e) => { + if(e.target.id === 'wrapper') onClose(); + } + + let historyList; + if (history && history.length > 0) { + historyList = history.map((event, index) => { + return ( +
  • {event}
  • + ) + }) + } else { + historyList =
  • Currently no diplomatic/medical issues in this country.
  • ; + } + + return ( +
    +
    +
    +
    +
    +
    +

    {countries}

    +

    {dangerLevel}

    +
    +
    +

    History

    +
      {historyList}
    +
    +
    +
    +
    +
    +
    + ) +} + +export default HistoryModal; diff --git a/src/components/travel-advisory/ListCountries.jsx b/src/components/travel-advisory/ListCountries.jsx new file mode 100644 index 0000000..57817af --- /dev/null +++ b/src/components/travel-advisory/ListCountries.jsx @@ -0,0 +1,65 @@ +import countriesData from './countries.json' assert { type: 'json' }; +import HistoryModal from "./HistoryModal"; +import { useState } from "preact/hooks"; + +export function getDangerLevel(danger) { + let dangerLevel; + switch (danger) { + case 0: + dangerLevel = "Take normal security precautions" + break; + case 1: + dangerLevel = "Exercise a high degree of caution" + break; + case 2: + dangerLevel = "Avoid non-essential travel" + break; + case 3: + dangerLevel = "Avoid all travel" + break; + default: + dangerLevel = "Seems like the danger level is broken!" + 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.danger); + + const settlementsList = country.settlements.map((settlement) => { + return ( +
    +

    {settlement.name}

    +

    {getDangerLevel(settlement.danger)}

    +
    + ) + }) + + return ( +
    +
    +

    {country.name}

    +

    {dangerLevel}

    +
    {settlementsList}
    + +
    + setShowModal(false)} countries={selectedCountry} dangerLevel={selectedDangerLevel} history={selectedCountryHistory} /> +
    + ) + }) +} diff --git a/src/components/travel-advisory/countries.json b/src/components/travel-advisory/countries.json new file mode 100644 index 0000000..f50474c --- /dev/null +++ b/src/components/travel-advisory/countries.json @@ -0,0 +1,253 @@ +{ + "countries": [ + { + "name": "Anatoli", + "url": "anatoli", + "danger": 0, + "image": "/countries/anatoli.webp", + "settlements": [], + "history": [] + }, + { + "name": "Auckland", + "url": "auckland", + "danger": 0, + "image": "/countries/auckland.webp", + "settlements": [], + "history": [] + }, + { + "name": "Aura Regions", + "url": "auraregions", + "danger": 0, + "image": "/countries/auraregions.webp", + "settlements": [], + "history": [] + }, + { + "name": "Birch Boat Town", + "url": "birchboattown", + "danger": 0, + "image": "/countries/birchboattown.webp", + "settlements": [], + "history": [] + }, + { + "name": "Birch Lodges Community Town", + "url": "birchlodges", + "danger": 0, + "image": "/countries/birchlodges.webp", + "settlements": [], + "history": [] + }, + { + "name": "Country Warp", + "url": "countrywarp", + "danger": 0, + "image": "/countries/countrywarp.webp", + "settlements": [], + "history": [] + }, + { + "name": "The Federation of Doodads and Gizmos", + "url": "doodadsandgizmos", + "danger": 0, + "image": "/countries/doodadsandgizmos.webp", + "settlements": [], + "history": [] + }, + { + "name": "Eagle City", + "url": "eaglecity", + "danger": 0, + "image": "/countries/eaglecity.webp", + "settlements": [], + "history": [] + }, + { + "name": "Fegal", + "url": "fegal", + "danger": 3, + "image": "/countries/fegal.webp", + "settlements": [], + "history": [ + "May 17th, 2023: Fegal has border security issues and it has not been solved as of now." + ] + }, + { + "name": "Halcandra", + "url": "halcandra", + "danger": 0, + "image": "/countries/halcandra.webp", + "settlements": [], + "history": [] + }, + { + "name": "Inkytown", + "url": "inkytown", + "danger": 0, + "image": "/countries/inkytown.webp", + "settlements": [], + "history": [] + }, + { + "name": "Kemonomimi Republic", + "url": "kemonomimi-republic", + "danger": 0, + "image": "/countries/kemonomimi.webp", + "settlements": [], + "history": [] + }, + { + "name": "Knowle Regions", + "url": "knowle-regions", + "danger": 0, + "image": "/countries/knowleregions.webp", + "settlements": [], + "history": [] + }, + { + "name": "Lion Land", + "url": "lionland", + "danger": 0, + "image": "/countries/lionland.webp", + "settlements": [], + "history": [] + }, + { + "name": "landrepeatland", + "url": "landrepeatland", + "danger": 0, + "image": "/countries/landrepeatland.webp", + "settlements": [], + "history": [] + }, + { + "name": "Mart's Extraordinarily Sublime State", + "url": "mess", + "danger": 0, + "image": "/countries/mess.webp", + "settlements": [], + "history": [] + }, + { + "name": "Mojave", + "url": "mojave", + "danger": 0, + "image": "/countries/mojave.webp", + "settlements": [], + "history": [] + }, + { + "name": "Open Republic", + "url": "open-republic", + "danger": 0, + "image": "/countries/openrepublic.webp", + "settlements": [], + "history": [] + }, + { + "name": "PLC", + "url": "plc", + "danger": 0, + "image": "/countries/plc.webp", + "settlements": [], + "history": [] + }, + { + "name": "Plutonia Imperium", + "url": "plutonia-imperium", + "danger": 0, + "image": "/countries/plutoniaimperium.webp", + "settlements": [], + "history": [] + }, + { + "name": "The Federal Democracy of Solstice", + "url": "solstice", + "danger": 0, + "image": "/countries/solstice.webp", + "settlements": [], + "history": [] + }, + { + "name": "Southeastern Islands", + "url": "southeastern-islands", + "danger": 1, + "image": "/countries/sei.webp", + "settlements": [ + { + "name": "Forêt Québec", + "danger": 3 + } + ], + "history": [ + "July 15th, 2023: Frequent instances of instability have been surfacing in Forêt Québec lately." + ] + }, + { + "name": "Sulópolis", + "url": "sulopolis", + "danger": 0, + "image": "/countries/sulopolis.webp", + "settlements": [], + "history": [] + }, + { + "name": "TAY", + "url": "tay", + "danger": 0, + "image": "/countries/tay.webp", + "settlements": [], + "history": [] + }, + { + "name": "Union of Soviet Sovereign Republics", + "url": "ussr", + "danger": 0, + "image": "/countries/ussr.webp", + "settlements": [], + "history": [] + }, + { + "name": "Veronian Controlled Territories", + "url": "veronian-controlled-territories", + "danger": 0, + "image": "/countries/vct.webp", + "settlements": [], + "history": [] + }, + { + "name": "Vyxalla", + "url": "vyxalla", + "danger": 0, + "image": "/countries/vyxalla.webp", + "settlements": [], + "history": [] + }, + { + "name": "The Republic of Whale City", + "url": "whale-city", + "danger": 0, + "image": "/countries/whalecity.webp", + "settlements": [], + "history": [] + }, + { + "name": "The Federation of Yavno", + "url": "yavno", + "danger": 0, + "image": "/countries/yavno.webp", + "settlements": [], + "history": [] + }, + { + "name": "The Republic of You on Kazoo", + "url": "you-on-kazoo", + "danger": 0, + "image": "/countries/youonkazoo.webp", + "settlements": [], + "history": [] + } + ] +} diff --git a/src/env.d.ts b/src/env.d.ts new file mode 100644 index 0000000..acef35f --- /dev/null +++ b/src/env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro new file mode 100644 index 0000000..6aeea4e --- /dev/null +++ b/src/layouts/Layout.astro @@ -0,0 +1,31 @@ +--- +import Navbar from "../components/Navbar"; +import PSA from "../components/PSA.astro"; + +const { title, description } = Astro.props; +--- + + + + + + + + + + {title} + + + + + + +
    +

    Alure Regions is a fictional country made for the bits & Bytes Minecraft Server

    +

    This website is proudly written using Astro and Tailwind CSS

    +
    + + diff --git a/src/pages/index.astro b/src/pages/index.astro new file mode 100644 index 0000000..902886e --- /dev/null +++ b/src/pages/index.astro @@ -0,0 +1,62 @@ +--- +import Layout from '../layouts/Layout.astro'; +import "../styles/globals.css"; +--- + + +
    +
    +
    +

    Welcome to the Alure Regions

    +

    The official website of the Government of Alure Regions

    +
    +
    +
      +
    • +
      +
      +

      Alee Isle

      + Est. 2017 - Premier: Alee +

      Capital of Alure Regions and the original home of MinePot

      +
      +
      +
    • +
    • +
      +
      +

      BreadCroust

      + Est. 2018 - Premier: Croust +

      Home to MinePot Barton Centre and athletics

      +
      +
      +
    • +
    • +
      +
      +

      SkyCity

      + Est. 2018 - Premier: Rahilu +

      A city that floats in the sky

      +
      +
      +
    • +
    • +
      +
      +

      Silicon Valley

      + Est. 2018 - Premier: Inkydink +

      Where all things tech-related lie

      +
      +
      +
    • +
    +
    +

    About Alure Regions

    +

    Alure Regions was founded in July 2023 with the goal of achieving greater autonomy in our regions.

    +

    Originally known as Alee Isle Regions, we later became Southeastern Islands before branching out on our own.

    +

    We are committed to continuous improvement and growth as small regions.

    + +

    View more

    +
    +
    +
    diff --git a/src/pages/travel-advisory.astro b/src/pages/travel-advisory.astro new file mode 100644 index 0000000..693a4fe --- /dev/null +++ b/src/pages/travel-advisory.astro @@ -0,0 +1,32 @@ +--- +import Countries from '../components/travel-advisory/countries.json' +import Layout from "../layouts/Layout.astro"; +--- + +
    +
    +

    Legend

    +
      +
    • +

      Take normal security precautions

      +

      Take similar precautions to those you would take in Alure Regions.

      +
    • +
    • +

      Exercise a high degree of caution

      +

      There are certain safety and security concerns or the situation could change quickly. Be very cautious at all times, monitor local media and follow the instructions of local authorities.

      +

      IMPORTANT: The two levels below are official Government of Alure Regions Travel Advisories and are issued when the safety and security of Alurians travelling or living in the country or region may be at risk.

      +
    • +
    • +

      Avoid non-essential travel

      +

      Your safety and security could be at risk. You should think about your need to travel to this country, territory or region based on family or business requirements, knowledge of or familiarity with the region, and other factors. If you are already there, think about whether you really need to be there. If you do not need to be there, you should think about leaving.

      +
    • +
    • +

      Avoid all travel

      +

      You should not travel to this country, territory or region. Your personal safety and security are at great risk. If you are already there, you should think about leaving if it is safe to do so.

      +
    • +
    +
    +

    WARNING! This page may be inaccurate at times, refer to the Minecraft General Announcements channel for the latest updates

    + +
    +
    diff --git a/src/posts/outbreak.md b/src/posts/outbreak.md new file mode 100644 index 0000000..d3e4a40 --- /dev/null +++ b/src/posts/outbreak.md @@ -0,0 +1,15 @@ +--- +title: Parasite Outbreak +description: We are advising people to be careful when travelling around the world. +author: The President of the Alure Regions +date: '2023-07-19' +tags: ['announcement', 'travel'] +--- +# Parasite Outbreak +As of recently, we were made aware about the recent outbreak. It may have appeared that it is spreading around the world, we are advising people to be careful when travelling. + +# Our response +We have also made a travel advisory statement for people who are travelling around the world. You can find it [here](/travel-advisory). + +# What you can do +If you are currently travelling, be sure to self-isolate for 2 weeks at a hotel. If you are currently having symptoms, be sure to contact local health authorities. diff --git a/src/posts/website-launched.md b/src/posts/website-launched.md new file mode 100644 index 0000000..64ca8f3 --- /dev/null +++ b/src/posts/website-launched.md @@ -0,0 +1,13 @@ +--- +title: Website Launched +description: Our new website is now available! +author: The President of the Alure Regions +date: '2023-07-15' +tags: ['announcement'] +--- +# Our new website has officially launched! +As you have seen, we have been actively developing this brand new site! + +You can expect updates from us, whether if its updating travel advisories or announcing a brand new government service within Alure Regions. + +Of course, this site will get regularly updated overtime, so stay tuned for more updates to this site! diff --git a/src/styles/globals.css b/src/styles/globals.css new file mode 100644 index 0000000..f8c09c8 --- /dev/null +++ b/src/styles/globals.css @@ -0,0 +1,20 @@ +@import '@fontsource-variable/exo'; +@tailwind base; +@tailwind components; +@tailwind utilities; + +:root { + --foreground-rgb: 255, 255, 255; + --background-start-rgb: 0, 0, 0; + --background-end-rgb: 0, 0, 0; +} + +body { + color: rgb(var(--foreground-rgb)); + background: linear-gradient( + to bottom, + transparent, + rgb(var(--background-end-rgb)) + ) + rgb(var(--background-start-rgb)); +} -- cgit v1.2.3