From da4c3d383879478881b93e0c4ad26ca6839c35ef Mon Sep 17 00:00:00 2001 From: MeowcaTheoRange Date: Sun, 24 Sep 2023 20:15:59 -0500 Subject: [PATCH] Fix more bugs --- src/components/form/template/clan.tsx | 2 +- src/components/form/template/troll.tsx | 2 +- src/pages/api/clan/[clan]/index.ts | 21 +++++++++++++-------- src/styles/global_form.module.css | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/components/form/template/clan.tsx b/src/components/form/template/clan.tsx index 1f4f32b..742cf95 100644 --- a/src/components/form/template/clan.tsx +++ b/src/components/form/template/clan.tsx @@ -387,7 +387,7 @@ export default function ClanFormTemplate({ The color that represents your clan the most.
- {values.color != null && errors.color == null ? ( + {values.color != null ? ( <>
Red diff --git a/src/components/form/template/troll.tsx b/src/components/form/template/troll.tsx index a49358c..7f2b5f2 100644 --- a/src/components/form/template/troll.tsx +++ b/src/components/form/template/troll.tsx @@ -790,7 +790,7 @@ export default function TrollFormTemplate({
- {values.textColor != null && errors.textColor == null ? ( + {values.textColor != null ? ( <>
Red diff --git a/src/pages/api/clan/[clan]/index.ts b/src/pages/api/clan/[clan]/index.ts index 05ba11f..13bc9e8 100644 --- a/src/pages/api/clan/[clan]/index.ts +++ b/src/pages/api/clan/[clan]/index.ts @@ -59,15 +59,20 @@ export default async function handler( // Encrypt code lole serverClan.code = await hash(serverClan.code); - - if ( - serverClan.flairs != null && - !compareLevels(getLevel(checkExistingClan), "SUPPORTER") - ) { - serverClan.bgimage = null; - serverClan.css = null; - } const bothClans = MergeServerClans(checkExistingClan, serverClan); + if ( + bothClans.flairs == null || + !( + bothClans.flairs != null && + compareLevels(getLevel(checkExistingClan), "SUPPORTER") + ) + ) { + bothClans.bgimage = null; + bothClans.css = null; + } + if (bothClans.bgimage === "") bothClans.bgimage = null; + if (bothClans.css === "") bothClans.css = null; + const newClan = await changeClan(bothClans); if (newClan == null) return res.status(503).end(); // Give cookies, redundant style diff --git a/src/styles/global_form.module.css b/src/styles/global_form.module.css index 091f7f9..33977ff 100644 --- a/src/styles/global_form.module.css +++ b/src/styles/global_form.module.css @@ -93,7 +93,7 @@ width: 25ch; color: inherit; box-shadow: inset 0 0 2px currentColor; - background-color: transparent; + background-color: var(--pri-bg); border: 1px solid currentColor; padding: 4px 8px;