feat: complete UI rebuild, responsive fixes, dark mode UI, and Team block overhaul
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
const snapshotPath = path.join(process.cwd(), 'scripts', 'content-snapshot.json')
|
||||
const snapshot = JSON.parse(fs.readFileSync(snapshotPath, 'utf-8'))
|
||||
|
||||
const firstPersonRegexPL = /(^|[\s.,?!:;])(zapewniam|przeprowadzę|przeanalizuję|pomogę|pomagam|odpowiem|mnie|ze mną|moim|mój|zajmuję|działam|przygotowuję|przesyłam|wyliczam|zajmę)([\s.,?!:;]|$)/i
|
||||
const firstPersonRegexDE = /(^|[\s.,?!:;])(ich|mich|mir|mein|meine|meinen|helfe|kümmere|begleite|anbiete)([\s.,?!:;]|$)/i
|
||||
|
||||
const matches: any[] = []
|
||||
|
||||
function checkObject(obj: any, contextInfo: any) {
|
||||
if (Array.isArray(obj)) {
|
||||
obj.forEach((item, index) => checkObject(item, { ...contextInfo, index }))
|
||||
} else if (obj !== null && typeof obj === 'object') {
|
||||
// Pomiń blok Bio
|
||||
if (obj.blockType === 'bio') {
|
||||
return
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
if (typeof value === 'string') {
|
||||
const isMatchPL = contextInfo.locale === 'pl' && firstPersonRegexPL.test(value)
|
||||
const isMatchDE = contextInfo.locale === 'de' && firstPersonRegexDE.test(value)
|
||||
|
||||
if (isMatchPL || isMatchDE) {
|
||||
matches.push({
|
||||
pageSlug: contextInfo.pageSlug,
|
||||
blockType: obj.blockType || 'unknown',
|
||||
field: key,
|
||||
locale: contextInfo.locale,
|
||||
text: value
|
||||
})
|
||||
}
|
||||
} else {
|
||||
checkObject(value, { ...contextInfo, field: key })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const page of snapshot.pages) {
|
||||
if (page.pl) checkObject(page.pl.layout, { pageSlug: page.pl.slug || 'home', locale: 'pl' })
|
||||
if (page.de) checkObject(page.de.layout, { pageSlug: page.de.slug || 'home', locale: 'de' })
|
||||
}
|
||||
|
||||
for (const [slug, data] of Object.entries(snapshot.globals)) {
|
||||
const typedData = data as any;
|
||||
if (typedData.pl) checkObject(typedData.pl, { pageSlug: `global:${slug}`, locale: 'pl' })
|
||||
if (typedData.de) checkObject(typedData.de, { pageSlug: `global:${slug}`, locale: 'de' })
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(matches, null, 2))
|
||||
Reference in New Issue
Block a user