Replace SITE_CONFIG, UI_CONFIG, METADATA_CONFIG... to SITE, UI, METADATA...

This commit is contained in:
prototypa
2023-08-22 22:22:53 -04:00
parent 9d23150832
commit da8ef74b38
21 changed files with 83 additions and 83 deletions

View File

@ -1,7 +1,7 @@
---
import { SITE_CONFIG } from '~/utils/config';
import { SITE } from '~/utils/config';
---
<span class="self-center ml-2 rtl:ml-0 rtl:mr-2 text-2xl md:text-xl font-bold text-gray-900 whitespace-nowrap dark:text-white">
🚀 {SITE_CONFIG?.name}
🚀 {SITE?.name}
</span>

View File

@ -1,5 +1,5 @@
---
import { APP_BLOG_CONFIG } from '~/utils/config';
import { APP_BLOG } from '~/utils/config';
import type { Post } from '~/types';
import Image from '~/components/common/Image.astro';
@ -39,7 +39,7 @@ const image = (await findImage(post.image));
</div>
<h3 class="mb-2 text-xl font-bold leading-tight sm:text-2xl font-heading">
{
!APP_BLOG_CONFIG?.post?.isEnabled ? (
!APP_BLOG?.post?.isEnabled ? (
post.title
) : (
<a

View File

@ -4,7 +4,7 @@ import { Icon } from 'astro-icon/components';
import Image from '~/components/common/Image.astro';
import PostTags from '~/components/blog/Tags.astro';
import { APP_BLOG_CONFIG } from '~/utils/config';
import { APP_BLOG } from '~/utils/config';
import type { Post } from '~/types';
import { getPermalink } from '~/utils/permalinks';
@ -18,7 +18,7 @@ export interface Props {
const { post } = Astro.props;
const image = (await findImage(post.image)) as ImageMetadata | undefined;
const link = APP_BLOG_CONFIG?.post?.isEnabled ? getPermalink(post.permalink, 'post') : '';
const link = APP_BLOG?.post?.isEnabled ? getPermalink(post.permalink, 'post') : '';
---
<article class={`max-w-md mx-auto md:max-w-none grid gap-6 md:gap-8 ${image ? 'md:grid-cols-2' : ''}`}>

View File

@ -1,7 +1,7 @@
---
import { getPermalink } from '~/utils/permalinks';
import { APP_BLOG_CONFIG } from '~/utils/config';
import { APP_BLOG } from '~/utils/config';
import type { Post } from '~/types';
export interface Props {
@ -23,7 +23,7 @@ const { tags, class: className = 'text-sm', title = undefined, isCategory = fals
<ul class={className}>
{tags.map((tag) => (
<li class="bg-gray-100 dark:bg-slate-700 inline-block mr-2 rtl:mr-0 rtl:ml-2 mb-2 py-0.5 px-2 lowercase font-medium">
{!APP_BLOG_CONFIG?.tag?.isEnabled ? (
{!APP_BLOG?.tag?.isEnabled ? (
tag
) : (
<a

View File

@ -1,9 +1,9 @@
---
import { Icon } from 'astro-icon/components';
import { getBlogPermalink } from '~/utils/permalinks';
import { I18N_CONFIG } from '~/utils/config';
import { I18N } from '~/utils/config';
const { textDirection } = I18N_CONFIG;
const { textDirection } = I18N;
---
<div class="mx-auto px-6 sm:px-6 max-w-3xl pt-8 md:pt-4 pb-12 md:pb-20">

View File

@ -1,10 +1,10 @@
---
import { GoogleAnalytics } from '@astrolib/analytics';
import { ANALYTICS_CONFIG } from '~/utils/config';
import { ANALYTICS } from '~/utils/config';
---
{
ANALYTICS_CONFIG?.vendors?.googleAnalytics?.id ? (
<GoogleAnalytics id={String(ANALYTICS_CONFIG.vendors.googleAnalytics.id)} partytown={ANALYTICS_CONFIG?.vendors?.googleAnalytics?.partytown} />
ANALYTICS?.vendors?.googleAnalytics?.id ? (
<GoogleAnalytics id={String(ANALYTICS.vendors.googleAnalytics.id)} partytown={ANALYTICS?.vendors?.googleAnalytics?.partytown} />
) : null
}

View File

@ -1,10 +1,10 @@
---
import { UI_CONFIG } from "~/utils/config";
import { UI } from "~/utils/config";
// TODO: This code is temporary
---
<script is:inline define:vars={{ defaultTheme: UI_CONFIG.theme || "system" }}>
<script is:inline define:vars={{ defaultTheme: UI.theme || "system" }}>
function applyTheme(theme) {
if (theme === "dark") {
document.documentElement.classList.add("dark");

View File

@ -1,8 +1,8 @@
---
import { UI_CONFIG } from '~/utils/config';
import { UI } from '~/utils/config';
---
<script is:inline define:vars={{ defaultTheme: UI_CONFIG.theme }}>
<script is:inline define:vars={{ defaultTheme: UI.theme }}>
function applyTheme(theme) {
if (theme === 'dark') {
document.documentElement.classList.add('dark');

View File

@ -4,8 +4,8 @@ import { AstroSeo } from '@astrolib/seo';
import type { AstroSeoProps } from '@astrolib/seo/src/types';
import { SITE_CONFIG, METADATA_CONFIG, I18N_CONFIG } from '~/utils/config';
import { MetaData } from '~/types';
import { SITE, METADATA, I18N } from '~/utils/config';
import type { MetaData } from '~/types';
import { getCanonical } from '~/utils/permalinks';
import { adaptOpenGraphImages } from '~/utils/images';
@ -34,9 +34,9 @@ const seoProps: AstroSeoProps = merge(
description: undefined,
openGraph: {
url: canonical,
site_name: SITE_CONFIG?.name,
site_name: SITE?.name,
images: [],
locale: I18N_CONFIG?.language || 'en',
locale: I18N?.language || 'en',
type: 'website',
},
twitter: {
@ -44,13 +44,13 @@ const seoProps: AstroSeoProps = merge(
},
},
{
title: METADATA_CONFIG?.title?.default,
titleTemplate: METADATA_CONFIG?.title?.template,
noindex: typeof METADATA_CONFIG?.robots?.index !== 'undefined' ? !METADATA_CONFIG.robots.index : undefined,
nofollow: typeof METADATA_CONFIG?.robots?.follow !== 'undefined' ? !METADATA_CONFIG.robots.follow : undefined,
description: METADATA_CONFIG?.description,
openGraph: METADATA_CONFIG?.openGraph,
twitter: METADATA_CONFIG?.twitter,
title: METADATA?.title?.default,
titleTemplate: METADATA?.title?.template,
noindex: typeof METADATA?.robots?.index !== 'undefined' ? !METADATA.robots.index : undefined,
nofollow: typeof METADATA?.robots?.follow !== 'undefined' ? !METADATA.robots.follow : undefined,
description: METADATA?.description,
openGraph: METADATA?.openGraph,
twitter: METADATA?.twitter,
},
{
title: title,

View File

@ -1,5 +1,5 @@
---
import { SITE_CONFIG } from "~/utils/config";
import { SITE } from "~/utils/config";
---
{SITE_CONFIG.googleSiteVerificationId && <meta name="google-site-verification" content={SITE_CONFIG.googleSiteVerificationId} />}
{SITE.googleSiteVerificationId && <meta name="google-site-verification" content={SITE.googleSiteVerificationId} />}

View File

@ -1,7 +1,7 @@
---
import { Icon } from 'astro-icon/components';
import { UI_CONFIG } from '~/utils/config';
import { UI } from '~/utils/config';
export interface Props {
label?: string;
@ -20,7 +20,7 @@ const {
---
{
!(UI_CONFIG.theme && UI_CONFIG.theme.endsWith(':only')) && (
!(UI.theme && UI.theme.endsWith(':only')) && (
<button type="button" class={className} aria-label={label} data-aw-toggle-color-scheme>
<Icon name={iconName} class={iconClass} />
</button>

View File

@ -1,5 +1,5 @@
---
import { APP_BLOG_CONFIG } from "~/utils/config";
import { APP_BLOG } from "~/utils/config";
import Grid from "~/components/blog/Grid.astro";
@ -29,11 +29,11 @@ const {
bg = await Astro.slots.render("bg"),
} = Astro.props;
const posts = APP_BLOG_CONFIG.isEnabled ? await findPostsByIds(postIds) : [];
const posts = APP_BLOG.isEnabled ? await findPostsByIds(postIds) : [];
---
{
APP_BLOG_CONFIG.isEnabled ? (
APP_BLOG.isEnabled ? (
<WidgetWrapper id={id} isDark={isDark} containerClass={classes?.container} bg={bg}>
<div class="flex flex-col lg:justify-between lg:flex-row mb-8">
{title && (
@ -42,7 +42,7 @@ const posts = APP_BLOG_CONFIG.isEnabled ? await findPostsByIds(postIds) : [];
class="text-3xl font-bold tracking-tight sm:text-4xl sm:leading-none group font-heading mb-2"
set:html={title}
/>
{APP_BLOG_CONFIG.list.isEnabled && linkText && linkUrl && (
{APP_BLOG.list.isEnabled && linkText && linkUrl && (
<a
class="text-muted dark:text-slate-400 hover:text-primary transition ease-in duration-200 block mb-6 lg:mb-0"
href={linkUrl}

View File

@ -1,5 +1,5 @@
---
import { APP_BLOG_CONFIG } from "~/utils/config";
import { APP_BLOG } from "~/utils/config";
import Grid from "~/components/blog/Grid.astro";
@ -29,11 +29,11 @@ const {
bg = await Astro.slots.render("bg"),
} = Astro.props;
const posts = APP_BLOG_CONFIG.isEnabled ? await findLatestPosts({ count }) : [];
const posts = APP_BLOG.isEnabled ? await findLatestPosts({ count }) : [];
---
{
APP_BLOG_CONFIG.isEnabled ? (
APP_BLOG.isEnabled ? (
<WidgetWrapper id={id} isDark={isDark} containerClass={classes?.container} bg={bg}>
<div class="flex flex-col lg:justify-between lg:flex-row mb-8">
{title && (
@ -42,7 +42,7 @@ const posts = APP_BLOG_CONFIG.isEnabled ? await findLatestPosts({ count }) : [];
class="text-3xl font-bold tracking-tight sm:text-4xl sm:leading-none group font-heading mb-2"
set:html={title}
/>
{APP_BLOG_CONFIG.list.isEnabled && linkText && linkUrl && (
{APP_BLOG.list.isEnabled && linkText && linkUrl && (
<a
class="text-muted dark:text-slate-400 hover:text-primary transition ease-in duration-200 block mb-6 lg:mb-0"
href={linkUrl}

View File

@ -1,6 +1,6 @@
---
import { Icon } from 'astro-icon/components';
import { SITE_CONFIG } from '~/utils/config';
import { SITE } from '~/utils/config';
import { getHomePermalink } from '~/utils/permalinks';
interface Link {
@ -32,7 +32,7 @@ const { socialLinks = [], secondaryLinks = [], links = [], footNote = '', theme
<div class="grid grid-cols-12 gap-4 gap-y-8 sm:gap-8 py-8 md:py-12">
<div class="col-span-12 lg:col-span-4">
<div class="mb-2">
<a class="inline-block font-bold text-xl" href={getHomePermalink()}>{SITE_CONFIG?.name}</a>
<a class="inline-block font-bold text-xl" href={getHomePermalink()}>{SITE?.name}</a>
</div>
<div class="text-sm text-muted">
{