diff --git a/defaultState.ts b/defaultState.ts index eea8787..202e6e5 100644 --- a/defaultState.ts +++ b/defaultState.ts @@ -89,5 +89,5 @@ export const defaultState = `
Questions? Chat with the {workspace.brandName} team and get answers.
+Questions? Chat with the ${brandNameAutofill} team and get answers.
` diff --git a/scripts/replace-static-placeholder/index.ts b/scripts/replace-static-placeholder/index.ts new file mode 100644 index 0000000..3d4512a --- /dev/null +++ b/scripts/replace-static-placeholder/index.ts @@ -0,0 +1,43 @@ +import DBClient from '@/lib/db' + +const db = DBClient.getInstance() + +const run = async () => { + const faultyContent = await db.setting.findMany({ + where: { + content: { + contains: ' {workspace.brandName} ', + }, + }, + }) + + console.info( + `Found ${faultyContent.length} faulty rows with hardcoded {workspace.brandName}`, + ) + + let counter = 0 + + for (const row of faultyContent) { + // Replace static placeholder with data that was supposed to be rendered + const newContent = row.content?.replaceAll( + ' {workspace.brandName} ', + ' {{workspace.brandName}} ', + ) + try { + // This technically can be done with an updateMany -> regex replace matcher but, meh + console.info(' > Fixing data for setting with id', row.id) + await db.setting.update({ + where: { id: row.id }, + data: { + content: newContent, + }, + }) + counter++ + } catch (e) { + console.error(e) + } + } + console.info('Fixed static rows for', counter, 'entries') +} + +run() diff --git a/src/app/globals.css b/src/app/globals.css index b092483..b77944d 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -173,7 +173,7 @@ table { margin-top: 4px; margin-bottom: 4px; padding: 3px 0px; - word-break:break-word; + word-break: break-word; } .callout-container > .callout-icon {