@schandlergarcia/sf-web-components 1.0.14 ā 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -123,6 +123,7 @@ const targetPagesDir = path.join(cwd, 'src/pages');
|
|
|
123
123
|
console.log('\nš Installing page templates...\n');
|
|
124
124
|
|
|
125
125
|
let templatesInstalled = 0;
|
|
126
|
+
const installedTemplates = [];
|
|
126
127
|
|
|
127
128
|
if (fs.existsSync(templatesDir)) {
|
|
128
129
|
// Create target pages directory if it doesn't exist
|
|
@@ -136,20 +137,49 @@ if (fs.existsSync(templatesDir)) {
|
|
|
136
137
|
const sourcePath = path.join(templatesDir, template);
|
|
137
138
|
const targetFileName = template.replace('.template', '');
|
|
138
139
|
const targetPath = path.join(targetPagesDir, targetFileName);
|
|
140
|
+
const pageName = targetFileName.replace('.tsx', '');
|
|
141
|
+
|
|
142
|
+
// Always overwrite to ensure latest templates
|
|
143
|
+
try {
|
|
144
|
+
const content = fs.readFileSync(sourcePath, 'utf-8');
|
|
145
|
+
fs.writeFileSync(targetPath, content, 'utf-8');
|
|
146
|
+
console.log(` ā Installed ${targetFileName}`);
|
|
147
|
+
templatesInstalled++;
|
|
148
|
+
installedTemplates.push(pageName);
|
|
149
|
+
} catch (error) {
|
|
150
|
+
console.error(` ā Failed to install ${targetFileName}: ${error.message}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
139
154
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
155
|
+
// Update routes.tsx to use the installed templates
|
|
156
|
+
const routesPath = path.join(cwd, 'src/routes.tsx');
|
|
157
|
+
if (fs.existsSync(routesPath) && installedTemplates.length > 0) {
|
|
158
|
+
console.log('\nš Updating routes.tsx...\n');
|
|
159
|
+
|
|
160
|
+
try {
|
|
161
|
+
let routesContent = fs.readFileSync(routesPath, 'utf-8');
|
|
162
|
+
let routesUpdated = false;
|
|
163
|
+
|
|
164
|
+
for (const pageName of installedTemplates) {
|
|
165
|
+
// Match import statements like: import Home from './features/.../Home' or import Home from './pages/Home'
|
|
166
|
+
const importRegex = new RegExp(`import ${pageName} from ['"]\\./(features|pages)/[^'"]+/${pageName}['"];?`, 'g');
|
|
167
|
+
|
|
168
|
+
if (importRegex.test(routesContent)) {
|
|
169
|
+
routesContent = routesContent.replace(
|
|
170
|
+
importRegex,
|
|
171
|
+
`import ${pageName} from './pages/${pageName}';`
|
|
172
|
+
);
|
|
173
|
+
routesUpdated = true;
|
|
174
|
+
console.log(` ā Updated ${pageName} import`);
|
|
149
175
|
}
|
|
150
|
-
} else {
|
|
151
|
-
console.log(` ā Skipped ${targetFileName} (already exists)`);
|
|
152
176
|
}
|
|
177
|
+
|
|
178
|
+
if (routesUpdated) {
|
|
179
|
+
fs.writeFileSync(routesPath, routesContent, 'utf-8');
|
|
180
|
+
}
|
|
181
|
+
} catch (error) {
|
|
182
|
+
console.error(` ā Failed to update routes.tsx: ${error.message}`);
|
|
153
183
|
}
|
|
154
184
|
}
|
|
155
185
|
|
|
@@ -1,46 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Button } from '@schandlergarcia/sf-web-components';
|
|
1
|
+
import { RocketLaunchIcon } from "@heroicons/react/24/outline";
|
|
2
|
+
import { EmptyState } from '@schandlergarcia/sf-web-components';
|
|
4
3
|
|
|
5
4
|
export default function HomePage() {
|
|
6
|
-
const navigate = useNavigate();
|
|
7
|
-
const [searchText, setSearchText] = useState("");
|
|
8
|
-
|
|
9
|
-
const handleSearch = (e: React.FormEvent) => {
|
|
10
|
-
e.preventDefault();
|
|
11
|
-
// Navigate to your search results page
|
|
12
|
-
console.log("Search:", searchText);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
5
|
return (
|
|
16
|
-
<div className="flex min-h-
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Your application is ready to go.
|
|
24
|
-
</p>
|
|
25
|
-
</div>
|
|
26
|
-
<form onSubmit={handleSearch} className="flex flex-col gap-4 items-center">
|
|
27
|
-
<div className="flex gap-2 w-full max-w-2xl">
|
|
28
|
-
<input
|
|
29
|
-
type="text"
|
|
30
|
-
value={searchText}
|
|
31
|
-
onChange={(e) => setSearchText(e.target.value)}
|
|
32
|
-
placeholder="Search..."
|
|
33
|
-
className="flex-1 px-4 py-2 border border-slate-300 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-50 focus:outline-none focus:ring-2 focus:ring-slate-400"
|
|
34
|
-
/>
|
|
35
|
-
<Button type="submit">Search</Button>
|
|
36
|
-
</div>
|
|
37
|
-
<div className="flex gap-2">
|
|
38
|
-
<Button variant="outline" onClick={() => navigate("/about")}>
|
|
39
|
-
Learn More
|
|
40
|
-
</Button>
|
|
41
|
-
</div>
|
|
42
|
-
</form>
|
|
43
|
-
</div>
|
|
6
|
+
<div className="flex min-h-screen items-center justify-center bg-slate-50 dark:bg-slate-950 transition-colors">
|
|
7
|
+
<EmptyState
|
|
8
|
+
size="lg"
|
|
9
|
+
icon={<RocketLaunchIcon className="h-14 w-14" />}
|
|
10
|
+
heading="Bespoke App Template"
|
|
11
|
+
body="Component library loaded and ready to go."
|
|
12
|
+
/>
|
|
44
13
|
</div>
|
|
45
14
|
);
|
|
46
15
|
}
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
export default function Search() {
|
|
2
2
|
return (
|
|
3
|
-
<div className="flex min-h-[80vh] items-center justify-center px-4 sm:px-6 lg:px-8">
|
|
3
|
+
<div className="flex min-h-[80vh] items-center justify-center px-4 sm:px-6 lg:px-8 bg-slate-50 dark:bg-slate-950 transition-colors">
|
|
4
4
|
<div className="w-full max-w-4xl">
|
|
5
5
|
<div className="text-center mb-8">
|
|
6
6
|
<h1 className="text-4xl font-bold text-slate-900 dark:text-slate-50 mb-4">Search</h1>
|
|
7
7
|
<p className="text-lg text-slate-600 dark:text-slate-300">Find records across your organization.</p>
|
|
8
8
|
</div>
|
|
9
|
-
<
|
|
10
|
-
<input
|
|
11
|
-
type="text"
|
|
12
|
-
placeholder="Search..."
|
|
13
|
-
className="flex-1 px-4 py-2 border border-slate-300 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-50 focus:outline-none focus:ring-2 focus:ring-slate-400"
|
|
14
|
-
/>
|
|
15
|
-
<button className="px-4 py-2 bg-slate-900 dark:bg-slate-50 text-white dark:text-slate-900 rounded-lg hover:bg-slate-700 dark:hover:bg-slate-200 transition-colors">
|
|
16
|
-
Search
|
|
17
|
-
</button>
|
|
18
|
-
</div>
|
|
9
|
+
<p className="text-center text-slate-500 dark:text-slate-400">Search functionality coming soon...</p>
|
|
19
10
|
</div>
|
|
20
11
|
</div>
|
|
21
12
|
);
|