Initial commit

This commit is contained in:
2026-08-24 20:35:18 +05:30
commit 1dc582ba07
85 changed files with 21081 additions and 0 deletions

41
replace_required.js Normal file
View File

@@ -0,0 +1,41 @@
const fs = require('fs');
const req = (label) => `label={<span>${label} <span style={{ color: 'var(--color-error)' }}>*</span></span>}`;
function processFile(file) {
let content = fs.readFileSync(file, 'utf8');
// Find all components with isRequired
// We need to match: label="Something" ... isRequired
// First, find all lines with label="..."
// If a block has isRequired, replace the label and remove isRequired.
const tags = ['TextInput', 'Selector', 'NumberInput', 'TimeInput'];
// A simple regex to find JSX tags and their props
const regex = /<(TextInput|Selector|NumberInput|TimeInput)([^>]+)isRequired([^>]*)>/g;
content = content.replace(regex, (match, tag, before, after) => {
// extract label
const labelMatch = before.match(/label="([^"]+)"/);
if (!labelMatch) {
// maybe label is after isRequired
const labelMatchAfter = after.match(/label="([^"]+)"/);
if (!labelMatchAfter) return match; // fallback
const newLabel = req(labelMatchAfter[1]);
return `<${tag}${before}${after.replace(labelMatchAfter[0], newLabel)}>`;
}
const newLabel = req(labelMatch[1]);
return `<${tag}${before.replace(labelMatch[0], newLabel)}${after}>`;
});
fs.writeFileSync(file, content);
}
processFile('src/features/nearle-admin/pages/OnboardTenantPage.tsx');
processFile('src/features/nearle-admin/pages/OnboardBranchPage.tsx');
console.log("Done");