From a75de51198d59a6dc126ba5a92fa17c30bbb8b2e Mon Sep 17 00:00:00 2001
From: Prospector <6166773+Prospector@users.noreply.github.com>
Date: Thu, 11 Jan 2024 16:12:25 -0800
Subject: [PATCH] Add API indicator and staging banner (#1563)
* Change text of Modrinth logo depending on the API url being used
* Staging banner
---
assets/styles/global.scss | 4 +++
components/brand/TextLogo.vue | 37 ++++++++++++++++++++++
composables/cosmetics.js | 1 +
layouts/default.vue | 59 ++++++++++++++++++++++++++++++++++-
4 files changed, 100 insertions(+), 1 deletion(-)
diff --git a/assets/styles/global.scss b/assets/styles/global.scss
index da9a1d852..fde901333 100644
--- a/assets/styles/global.scss
+++ b/assets/styles/global.scss
@@ -66,6 +66,8 @@ html {
--color-special-purple: #8e32f3;
--color-special-gray: #595b61;
+ --color-red-bg: rgba(204, 35, 69, 0.1);
+
--color-warning-bg: hsl(355, 70%, 88%);
--color-warning-text: hsl(342, 70%, 35%);
@@ -159,6 +161,8 @@ html {
--color-special-purple: #c78aff;
--color-special-gray: #9fa4b3;
+ --color-red-bg: rgba(255, 74, 110, 0.2);
+
--color-brand-green: #1bd96a;
--color-brand: var(--color-brand-green);
--color-brand-highlight: rgba(27, 217, 106, 0.25);
diff --git a/components/brand/TextLogo.vue b/components/brand/TextLogo.vue
index 4cb54a081..96923c3b4 100644
--- a/components/brand/TextLogo.vue
+++ b/components/brand/TextLogo.vue
@@ -9,10 +9,33 @@
viewBox="0 0 3307 593"
:class="{ animate: loading }"
>
+
+
+
+
+
+
+
const loading = useLoading()
+
+const config = useRuntimeConfig()
+
+const api = computed(() => {
+ const apiUrl = config.public.apiBaseUrl
+ if (apiUrl.startsWith('https://api.modrinth.com')) {
+ return 'prod'
+ } else if (apiUrl.startsWith('https://staging-api.modrinth.com')) {
+ return 'staging'
+ } else if (apiUrl.startsWith('localhost') || apiUrl.startsWith('127.0.0.1')) {
+ return 'localhost'
+ }
+ return 'foreign'
+})