refactor: rename functions

This commit is contained in:
radishzzz 2025-03-14 14:23:35 +00:00
parent ca1abd28c1
commit f5526f8622
17 changed files with 46 additions and 49 deletions

View file

@ -17,9 +17,6 @@ const {
imageUploader = false,
} = themeConfig.comment?.waline ?? {}
// Get current path
const currentPath = Astro.url.pathname
// Get the language code of Waline
function getWalineLang(currentPath: string, defaultLocale: string): string {
// Extract language code from path
@ -32,7 +29,7 @@ function getWalineLang(currentPath: string, defaultLocale: string): string {
}
// Get Waline language and generate configuration
const walineLang = getWalineLang(currentPath, defaultLocale)
const walineLang = getWalineLang(Astro.url.pathname, defaultLocale)
const walineConfigJson = JSON.stringify({
serverURL,
lang: walineLang,
@ -49,8 +46,7 @@ const walineConfigJson = JSON.stringify({
>
</div>
<!-- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
<!-- Not use is:inline or define:vars -->
<!-- Not use is:inline or define:vars >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
<script>
import { init } from '@waline/client'
import '@waline/client/style'
@ -76,7 +72,7 @@ initWaline()
document.addEventListener('astro:after-swap', initWaline)
</script>
<!-- Custom css styles >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
<!-- Custom css styles >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
<style is:global>
#waline .wl-login-info {
--at-apply: 'mt-0 mr-3'

View file

@ -1,11 +1,10 @@
---
import themeConfig from '@/config'
import { getPagePath } from '@/i18n/path'
import { getPageInfo } from '@/i18n/path'
const { title, subtitle } = themeConfig.site
const { titleSpace } = themeConfig.global
const currentPath = Astro.url.pathname
const { getLocalizedPath } = getPagePath(currentPath)
const { getLocalizedPath } = getPageInfo(Astro.url.pathname)
const marginBottom = {
1: 'mb-0.625',

View file

@ -1,11 +1,10 @@
---
import themeConfig from '@/config'
import { getPagePath } from '@/i18n/path'
import { getPageInfo } from '@/i18n/path'
const { title, subtitle } = themeConfig.site
const { titleSpace } = themeConfig.global
const currentPath = Astro.url.pathname
const { getLocalizedPath } = getPagePath(currentPath)
const { getLocalizedPath } = getPageInfo(Astro.url.pathname)
const marginBottom = {
1: 'mb-1.625',

View file

@ -1,10 +1,9 @@
---
import { getPagePath } from '@/i18n/path'
import { getPageInfo } from '@/i18n/path'
import { ui } from '@/i18n/ui'
const currentPath = Astro.url.pathname
const { currentLang, isHome, isPost, isTag, isAbout, getLocalizedPath }
= getPagePath(currentPath)
= getPageInfo(Astro.url.pathname)
const currentUI = ui[currentLang as keyof typeof ui]
const isPostActive = isHome || isPost

View file

@ -10,8 +10,7 @@ interface Props {
const { date, updatedDate, minutes } = Astro.props
const format = themeConfig.global.dateFormat
const currentPath = Astro.url.pathname
const isPost = isPostPage(currentPath)
const isPost = isPostPage(Astro.url.pathname)
const timeSpacingClass = isPost ? 'ml-1.75' : 'ml-1.5'
function formatDate(date: Date, format: 'YYYY-MM-DD' | 'MM-DD-YYYY' | 'DD-MM-YYYY' | 'MONTH DAY YYYY' | 'DAY MONTH YYYY') {