limpiar HTML de descripciones KAPPA + sync proyectos a Turso
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
export function stripHtml(html: string): string {
|
||||
if (!html) return ''
|
||||
return html
|
||||
.replace(/<[^>]*>/g, '')
|
||||
.replace(/ /g, ' ')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, "'")
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim()
|
||||
}
|
||||
|
||||
export function extractFirstSentence(text: string, maxLen = 200): string {
|
||||
const cleaned = stripHtml(text)
|
||||
const match = cleaned.match(/^[^.!?]+[.!?]/)
|
||||
if (match) return match[0].slice(0, maxLen)
|
||||
return cleaned.slice(0, maxLen)
|
||||
}
|
||||
|
||||
export function stripHtmlTags(html: string): string {
|
||||
return stripHtml(html)
|
||||
}
|
||||
@@ -1,5 +1,15 @@
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
|
||||
export interface ProjectRecord {
|
||||
id: number
|
||||
name: string
|
||||
key: string | null
|
||||
description: string | null
|
||||
status: string
|
||||
start_date: string | null
|
||||
end_date: string | null
|
||||
}
|
||||
|
||||
export interface AlphaUserRecord {
|
||||
id: number
|
||||
email: string
|
||||
@@ -70,6 +80,17 @@ export interface PerformanceRecord {
|
||||
}
|
||||
|
||||
export const tauriDb = {
|
||||
// Projects
|
||||
getProjects(): Promise<ProjectRecord[]> {
|
||||
return invoke('get_projects')
|
||||
},
|
||||
saveProject(project: ProjectRecord): Promise<number> {
|
||||
return invoke('save_project', { project })
|
||||
},
|
||||
deleteProject(id: number): Promise<void> {
|
||||
return invoke('delete_project', { id })
|
||||
},
|
||||
|
||||
// Users
|
||||
getUsers(): Promise<AlphaUserRecord[]> {
|
||||
return invoke('get_users')
|
||||
|
||||
Reference in New Issue
Block a user