Refactor TypeScript interfaces and types for consistency and readability
Gitea Auto Deploy / Deploy-Container (push) Successful in 49s
Gitea Auto Deploy / Deploy-Container (push) Successful in 49s
- Reformatted multiple TypeScript interfaces across various files to ensure consistent spacing and indentation. - Updated `changelog.ts`, `enka.ts`, `extraData.ts`, `gloval.d.ts`, `index.ts`, `lightconeDetail.ts`, `metaData.ts`, `mics.ts`, `modelConfig.ts`, `monsterDetail.ts`, `peakDetail.ts`, `pfDetail.ts`, `psConnect.ts`, `relicDetail.ts`, `showcase.ts`, `srtools.ts`, and `zod/index.ts` for improved code clarity. - Ensured all interfaces are properly formatted with consistent line breaks and spacing. - Made minor adjustments to the `tsconfig.json` file for formatting consistency.
This commit is contained in:
@@ -1,112 +1,112 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
'use client'
|
||||
import dynamic from "next/dynamic"
|
||||
import type { SingleValue } from "react-select"
|
||||
import Image from "next/image"
|
||||
import useLocaleStore from "@/stores/localeStore"
|
||||
import ParseText from "../parseText"
|
||||
import { themeColors } from "@/constant/constant"
|
||||
import type { Props as SelectProps } from "react-select"
|
||||
import { JSX } from "react"
|
||||
|
||||
const Select = dynamic(
|
||||
() => import("react-select").then(m => m.default),
|
||||
{ ssr: false }
|
||||
) as <Option, IsMulti extends boolean = false>(
|
||||
props: SelectProps<Option, IsMulti>
|
||||
) => JSX.Element
|
||||
|
||||
export type SelectOption = {
|
||||
value: string
|
||||
label: string
|
||||
imageUrl: string
|
||||
}
|
||||
|
||||
type SelectCustomProp = {
|
||||
customSet: SelectOption[]
|
||||
excludeSet: SelectOption[]
|
||||
selectedCustomSet: string
|
||||
placeholder: string
|
||||
setSelectedCustomSet: (value: string) => void
|
||||
}
|
||||
|
||||
export default function SelectCustomImage({ customSet, excludeSet, selectedCustomSet, placeholder, setSelectedCustomSet }: SelectCustomProp) {
|
||||
const options: SelectOption[] = customSet
|
||||
const { locale, theme } = useLocaleStore()
|
||||
|
||||
const c = themeColors[theme] || themeColors.winter
|
||||
|
||||
const customStyles = {
|
||||
option: (p: any, s: any) => ({
|
||||
...p,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
padding: '8px 12px',
|
||||
backgroundColor: s.isFocused ? c.bgHover : c.bg,
|
||||
color: c.text,
|
||||
cursor: 'pointer'
|
||||
}),
|
||||
|
||||
singleValue: (p: any) => ({
|
||||
...p,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
color: c.text
|
||||
}),
|
||||
|
||||
control: (p: any) => ({
|
||||
...p,
|
||||
backgroundColor: c.bg,
|
||||
borderColor: c.border,
|
||||
boxShadow: 'none'
|
||||
}),
|
||||
|
||||
menu: (p: any) => ({
|
||||
...p,
|
||||
backgroundColor: c.bg,
|
||||
color: c.text,
|
||||
zIndex: 9999
|
||||
}),
|
||||
|
||||
menuPortal: (p: any) => ({
|
||||
...p,
|
||||
zIndex: 9999
|
||||
})
|
||||
}
|
||||
|
||||
const formatOptionLabel = (option: SelectOption) => (
|
||||
<div className="flex items-center gap-1 w-full h-full">
|
||||
<Image
|
||||
unoptimized
|
||||
crossOrigin="anonymous"
|
||||
src={option.imageUrl}
|
||||
alt=""
|
||||
width={125}
|
||||
height={125}
|
||||
className="w-8 h-8 object-contain bg-warning-content rounded-full"
|
||||
/>
|
||||
<ParseText className='font-bold' text={option.label} locale={locale} />
|
||||
</div>
|
||||
)
|
||||
|
||||
return (
|
||||
<Select
|
||||
options={options.filter(opt => !excludeSet.some(ex => ex.value === opt.value))}
|
||||
value={options.find(opt => {
|
||||
return opt.value === selectedCustomSet
|
||||
}) || null}
|
||||
onChange={(selected: SingleValue<SelectOption>) => {
|
||||
setSelectedCustomSet(selected?.value || '')
|
||||
}}
|
||||
formatOptionLabel={formatOptionLabel}
|
||||
styles={customStyles}
|
||||
placeholder={placeholder}
|
||||
className="my-react-select-container"
|
||||
classNamePrefix="my-react-select"
|
||||
isSearchable
|
||||
isClearable
|
||||
/>
|
||||
)
|
||||
}
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
'use client'
|
||||
import dynamic from "next/dynamic"
|
||||
import type { SingleValue } from "react-select"
|
||||
import Image from "next/image"
|
||||
import useLocaleStore from "@/stores/localeStore"
|
||||
import ParseText from "../parseText"
|
||||
import { themeColors } from "@/constant/constant"
|
||||
import type { Props as SelectProps } from "react-select"
|
||||
import { JSX } from "react"
|
||||
|
||||
const Select = dynamic(
|
||||
() => import("react-select").then(m => m.default),
|
||||
{ ssr: false }
|
||||
) as <Option, IsMulti extends boolean = false>(
|
||||
props: SelectProps<Option, IsMulti>
|
||||
) => JSX.Element
|
||||
|
||||
export type SelectOption = {
|
||||
value: string
|
||||
label: string
|
||||
imageUrl: string
|
||||
}
|
||||
|
||||
type SelectCustomProp = {
|
||||
customSet: SelectOption[]
|
||||
excludeSet: SelectOption[]
|
||||
selectedCustomSet: string
|
||||
placeholder: string
|
||||
setSelectedCustomSet: (value: string) => void
|
||||
}
|
||||
|
||||
export default function SelectCustomImage({ customSet, excludeSet, selectedCustomSet, placeholder, setSelectedCustomSet }: SelectCustomProp) {
|
||||
const options: SelectOption[] = customSet
|
||||
const { locale, theme } = useLocaleStore()
|
||||
|
||||
const c = themeColors[theme] || themeColors.winter
|
||||
|
||||
const customStyles = {
|
||||
option: (p: any, s: any) => ({
|
||||
...p,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
padding: '8px 12px',
|
||||
backgroundColor: s.isFocused ? c.bgHover : c.bg,
|
||||
color: c.text,
|
||||
cursor: 'pointer'
|
||||
}),
|
||||
|
||||
singleValue: (p: any) => ({
|
||||
...p,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
color: c.text
|
||||
}),
|
||||
|
||||
control: (p: any) => ({
|
||||
...p,
|
||||
backgroundColor: c.bg,
|
||||
borderColor: c.border,
|
||||
boxShadow: 'none'
|
||||
}),
|
||||
|
||||
menu: (p: any) => ({
|
||||
...p,
|
||||
backgroundColor: c.bg,
|
||||
color: c.text,
|
||||
zIndex: 9999
|
||||
}),
|
||||
|
||||
menuPortal: (p: any) => ({
|
||||
...p,
|
||||
zIndex: 9999
|
||||
})
|
||||
}
|
||||
|
||||
const formatOptionLabel = (option: SelectOption) => (
|
||||
<div className="flex items-center gap-1 w-full h-full">
|
||||
<Image
|
||||
unoptimized
|
||||
crossOrigin="anonymous"
|
||||
src={option.imageUrl}
|
||||
alt=""
|
||||
width={125}
|
||||
height={125}
|
||||
className="w-8 h-8 object-contain bg-warning-content rounded-full"
|
||||
/>
|
||||
<ParseText className='font-bold' text={option.label} locale={locale} />
|
||||
</div>
|
||||
)
|
||||
|
||||
return (
|
||||
<Select
|
||||
options={options.filter(opt => !excludeSet.some(ex => ex.value === opt.value))}
|
||||
value={options.find(opt => {
|
||||
return opt.value === selectedCustomSet
|
||||
}) || null}
|
||||
onChange={(selected: SingleValue<SelectOption>) => {
|
||||
setSelectedCustomSet(selected?.value || '')
|
||||
}}
|
||||
formatOptionLabel={formatOptionLabel}
|
||||
styles={customStyles}
|
||||
placeholder={placeholder}
|
||||
className="my-react-select-container"
|
||||
classNamePrefix="my-react-select"
|
||||
isSearchable
|
||||
isClearable
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,118 +1,118 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
'use client'
|
||||
import dynamic from "next/dynamic"
|
||||
import type { SingleValue } from "react-select"
|
||||
import { replaceByParam } from '@/helper'
|
||||
import useLocaleStore from '@/stores/localeStore'
|
||||
import { themeColors } from '@/constant/constant'
|
||||
import type { Props as SelectProps } from "react-select"
|
||||
import { JSX } from "react"
|
||||
|
||||
const Select = dynamic(
|
||||
() => import("react-select").then(m => m.default),
|
||||
{ ssr: false }
|
||||
) as <Option, IsMulti extends boolean = false>(
|
||||
props: SelectProps<Option, IsMulti>
|
||||
) => JSX.Element
|
||||
|
||||
export type SelectOption = {
|
||||
id: string
|
||||
name: string
|
||||
time?: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
type SelectCustomProp = {
|
||||
customSet: SelectOption[]
|
||||
excludeSet: SelectOption[]
|
||||
selectedCustomSet: string
|
||||
placeholder: string
|
||||
setSelectedCustomSet: (value: string) => void
|
||||
}
|
||||
|
||||
export default function SelectCustomText({ customSet, excludeSet, selectedCustomSet, placeholder, setSelectedCustomSet }: SelectCustomProp) {
|
||||
const options: SelectOption[] = customSet
|
||||
const { theme } = useLocaleStore()
|
||||
const c = themeColors[theme] || themeColors.winter
|
||||
|
||||
const customStyles = {
|
||||
option: (p: any, s: any) => ({
|
||||
...p,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
padding: '8px 12px',
|
||||
backgroundColor: s.isFocused ? c.bgHover : c.bg,
|
||||
color: c.text,
|
||||
cursor: 'pointer'
|
||||
}),
|
||||
|
||||
singleValue: (p: any) => ({
|
||||
...p,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
color: c.text
|
||||
}),
|
||||
|
||||
control: (p: any) => ({
|
||||
...p,
|
||||
backgroundColor: c.bg,
|
||||
borderColor: c.border,
|
||||
boxShadow: 'none'
|
||||
}),
|
||||
|
||||
menu: (p: any) => ({
|
||||
...p,
|
||||
backgroundColor: c.bg,
|
||||
color: c.text,
|
||||
zIndex: 9999
|
||||
}),
|
||||
|
||||
menuPortal: (p: any) => ({
|
||||
...p,
|
||||
zIndex: 9999
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const formatOptionLabel = (option: SelectOption) => (
|
||||
<div className="flex flex-col gap-1 w-full h-full">
|
||||
<div
|
||||
className="font-bold text-lg"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: replaceByParam(
|
||||
option.name,
|
||||
[]
|
||||
)
|
||||
}}
|
||||
/>
|
||||
{option.time && <div className='text-base'>{option.time}</div>}
|
||||
{option.description && <div
|
||||
className="text-base"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: option.description
|
||||
}}
|
||||
/>}
|
||||
</div>
|
||||
)
|
||||
|
||||
return (
|
||||
<Select
|
||||
options={options.filter(opt => !excludeSet.some(ex => ex.id === opt.id))}
|
||||
value={options.find(opt => {
|
||||
return opt.id === selectedCustomSet
|
||||
}) || null}
|
||||
onChange={(selected: SingleValue<SelectOption>) => {
|
||||
setSelectedCustomSet(selected?.id || '')
|
||||
}}
|
||||
formatOptionLabel={formatOptionLabel}
|
||||
styles={customStyles}
|
||||
placeholder={placeholder}
|
||||
className="my-react-select-container"
|
||||
classNamePrefix="my-react-select"
|
||||
isSearchable
|
||||
isClearable
|
||||
/>
|
||||
)
|
||||
}
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
'use client'
|
||||
import dynamic from "next/dynamic"
|
||||
import type { SingleValue } from "react-select"
|
||||
import { replaceByParam } from '@/helper'
|
||||
import useLocaleStore from '@/stores/localeStore'
|
||||
import { themeColors } from '@/constant/constant'
|
||||
import type { Props as SelectProps } from "react-select"
|
||||
import { JSX } from "react"
|
||||
|
||||
const Select = dynamic(
|
||||
() => import("react-select").then(m => m.default),
|
||||
{ ssr: false }
|
||||
) as <Option, IsMulti extends boolean = false>(
|
||||
props: SelectProps<Option, IsMulti>
|
||||
) => JSX.Element
|
||||
|
||||
export type SelectOption = {
|
||||
id: string
|
||||
name: string
|
||||
time?: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
type SelectCustomProp = {
|
||||
customSet: SelectOption[]
|
||||
excludeSet: SelectOption[]
|
||||
selectedCustomSet: string
|
||||
placeholder: string
|
||||
setSelectedCustomSet: (value: string) => void
|
||||
}
|
||||
|
||||
export default function SelectCustomText({ customSet, excludeSet, selectedCustomSet, placeholder, setSelectedCustomSet }: SelectCustomProp) {
|
||||
const options: SelectOption[] = customSet
|
||||
const { theme } = useLocaleStore()
|
||||
const c = themeColors[theme] || themeColors.winter
|
||||
|
||||
const customStyles = {
|
||||
option: (p: any, s: any) => ({
|
||||
...p,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
padding: '8px 12px',
|
||||
backgroundColor: s.isFocused ? c.bgHover : c.bg,
|
||||
color: c.text,
|
||||
cursor: 'pointer'
|
||||
}),
|
||||
|
||||
singleValue: (p: any) => ({
|
||||
...p,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
color: c.text
|
||||
}),
|
||||
|
||||
control: (p: any) => ({
|
||||
...p,
|
||||
backgroundColor: c.bg,
|
||||
borderColor: c.border,
|
||||
boxShadow: 'none'
|
||||
}),
|
||||
|
||||
menu: (p: any) => ({
|
||||
...p,
|
||||
backgroundColor: c.bg,
|
||||
color: c.text,
|
||||
zIndex: 9999
|
||||
}),
|
||||
|
||||
menuPortal: (p: any) => ({
|
||||
...p,
|
||||
zIndex: 9999
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const formatOptionLabel = (option: SelectOption) => (
|
||||
<div className="flex flex-col gap-1 w-full h-full">
|
||||
<div
|
||||
className="font-bold text-lg"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: replaceByParam(
|
||||
option.name,
|
||||
[]
|
||||
)
|
||||
}}
|
||||
/>
|
||||
{option.time && <div className='text-base'>{option.time}</div>}
|
||||
{option.description && <div
|
||||
className="text-base"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: option.description
|
||||
}}
|
||||
/>}
|
||||
</div>
|
||||
)
|
||||
|
||||
return (
|
||||
<Select
|
||||
options={options.filter(opt => !excludeSet.some(ex => ex.id === opt.id))}
|
||||
value={options.find(opt => {
|
||||
return opt.id === selectedCustomSet
|
||||
}) || null}
|
||||
onChange={(selected: SingleValue<SelectOption>) => {
|
||||
setSelectedCustomSet(selected?.id || '')
|
||||
}}
|
||||
formatOptionLabel={formatOptionLabel}
|
||||
styles={customStyles}
|
||||
placeholder={placeholder}
|
||||
className="my-react-select-container"
|
||||
classNamePrefix="my-react-select"
|
||||
isSearchable
|
||||
isClearable
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user