[System Pop Up] Add help center with release notifications and "What's New" popup (#4256)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
bmcomfy
2025-06-26 14:11:15 -07:00
committed by GitHub
parent c2ae40bab5
commit 2d2cec2e79
23 changed files with 2952 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import { ResultItem } from '@/schemas/apiSchema'
import type { operations } from '@/types/comfyRegistryTypes'
export function formatCamelCase(str: string): string {
// Check if the string is camel case
@@ -502,3 +503,46 @@ export function nl2br(text: string): string {
if (!text) return ''
return text.replace(/\n/g, '<br />')
}
/**
* Converts a version string to an anchor-safe format by replacing dots with dashes.
* @param version The version string (e.g., "1.0.0", "2.1.3-beta.1")
* @returns The anchor-safe version string (e.g., "v1-0-0", "v2-1-3-beta-1")
* @example
* formatVersionAnchor("1.0.0") // returns "v1-0-0"
* formatVersionAnchor("2.1.3-beta.1") // returns "v2-1-3-beta-1"
*/
export function formatVersionAnchor(version: string): string {
return `v${version.replace(/\./g, '-')}`
}
/**
* Supported locale types for the application (from OpenAPI schema)
*/
export type SupportedLocale = NonNullable<
operations['getReleaseNotes']['parameters']['query']['locale']
>
/**
* Converts a string to a valid locale type with 'en' as default
* @param locale - The locale string to validate and convert
* @returns A valid SupportedLocale type, defaults to 'en' if invalid
* @example
* stringToLocale('fr') // returns 'fr'
* stringToLocale('invalid') // returns 'en'
* stringToLocale('') // returns 'en'
*/
export function stringToLocale(locale: string): SupportedLocale {
const supportedLocales: SupportedLocale[] = [
'en',
'es',
'fr',
'ja',
'ko',
'ru',
'zh'
]
return supportedLocales.includes(locale as SupportedLocale)
? (locale as SupportedLocale)
: 'en'
}