uai-direct 1.0.0
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/.firebaserc +5 -0
- package/README.md +32 -0
- package/bin/cli.js +146 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/index-CTk_bO4J.css +1 -0
- package/dist/assets/index-Cq3v5i7c.js +30 -0
- package/dist/favicon.ico +0 -0
- package/dist/icons.svg +24 -0
- package/dist/index.html +27 -0
- package/dist/logo-192x192.png +0 -0
- package/dist/logo-512x512.png +0 -0
- package/dist/masked-icon.svg +0 -0
- package/firebase.json +16 -0
- package/index.html +26 -0
- package/package.json +38 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/icons.svg +24 -0
- package/public/logo-192x192.png +0 -0
- package/public/logo-512x512.png +0 -0
- package/public/masked-icon.svg +0 -0
- package/src/App.tsx +8 -0
- package/src/assets/MissionKranti.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/UAIContainer.tsx +370 -0
- package/src/index.css +19 -0
- package/src/main.tsx +10 -0
- package/src/uai.config.json +17 -0
- package/tsconfig.json +7 -0
- package/vite.config.ts +6 -0
package/.firebaserc
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the Oxlint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend enabling type-aware lint rules by installing `oxlint-tsgolint` and editing `.oxlintrc.json`:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
21
|
+
"plugins": ["react", "typescript", "oxc"],
|
|
22
|
+
"options": {
|
|
23
|
+
"typeAware": true
|
|
24
|
+
},
|
|
25
|
+
"rules": {
|
|
26
|
+
"react/rules-of-hooks": "error",
|
|
27
|
+
"react/only-export-components": ["warn", { "allowConstantExport": true }]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
See the [Oxlint rules documentation](https://oxc.rs/docs/guide/usage/linter/rules) for the full list of rules and categories.
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import readline from 'readline';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(__filename);
|
|
10
|
+
|
|
11
|
+
const rl = readline.createInterface({
|
|
12
|
+
input: process.stdin,
|
|
13
|
+
output: process.stdout
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const askQuestion = (query) => new Promise((resolve) => rl.question(query, resolve));
|
|
17
|
+
|
|
18
|
+
const PRESET_COLORS = {
|
|
19
|
+
orange: { primary: '#ea580c', secondary: '#f97316' },
|
|
20
|
+
blue: { primary: '#2563eb', secondary: '#3b82f6' },
|
|
21
|
+
emerald: { primary: '#059669', secondary: '#10b981' },
|
|
22
|
+
green: { primary: '#059669', secondary: '#10b981' },
|
|
23
|
+
purple: { primary: '#7c3aed', secondary: '#8b5cf6' },
|
|
24
|
+
crimson: { primary: '#dc2626', secondary: '#ef4444' },
|
|
25
|
+
red: { primary: '#dc2626', secondary: '#ef4444' }
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
async function main() {
|
|
29
|
+
console.log('\n====================================================');
|
|
30
|
+
console.log(' UAI-DIRECT - Platform Setup Wizard ');
|
|
31
|
+
console.log('====================================================\n');
|
|
32
|
+
|
|
33
|
+
// Prompt 1: Platform Name (Up to 11 letters)
|
|
34
|
+
let rawName = '';
|
|
35
|
+
while (!rawName) {
|
|
36
|
+
const input = await askQuestion('Name your platform (up to 11 letters) [default: SAMPARK]: ');
|
|
37
|
+
const trimmed = input.trim().toUpperCase();
|
|
38
|
+
if (!trimmed) {
|
|
39
|
+
rawName = 'SAMPARK';
|
|
40
|
+
} else if (trimmed.length > 11) {
|
|
41
|
+
console.log('⚠️ Platform name must be 11 letters or fewer. Please try again.\n');
|
|
42
|
+
} else {
|
|
43
|
+
rawName = trimmed;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const platformName = rawName;
|
|
48
|
+
const letters = platformName.split('');
|
|
49
|
+
|
|
50
|
+
// Prompt 2: Fullform / Acronym Check
|
|
51
|
+
const hasFullformInput = await askQuestion(`\nDo you have a fullform/acronym for ${platformName}? (y/N): `);
|
|
52
|
+
const hasFullform = hasFullformInput.trim().toLowerCase().startsWith('y');
|
|
53
|
+
|
|
54
|
+
let fullFormPhrase = '';
|
|
55
|
+
let sequenceSteps = [];
|
|
56
|
+
|
|
57
|
+
if (hasFullform) {
|
|
58
|
+
const defaultPhrase = platformName === 'SAMPARK'
|
|
59
|
+
? 'Single Administrative Management Portal for Access, Resources and Knowledge'
|
|
60
|
+
: '';
|
|
61
|
+
|
|
62
|
+
const phrasePrompt = defaultPhrase
|
|
63
|
+
? `Enter fullform phrase [default: '${defaultPhrase}']: `
|
|
64
|
+
: `Enter fullform phrase for ${platformName}: `;
|
|
65
|
+
|
|
66
|
+
const inputPhrase = await askQuestion(phrasePrompt);
|
|
67
|
+
fullFormPhrase = inputPhrase.trim() || defaultPhrase;
|
|
68
|
+
|
|
69
|
+
if (fullFormPhrase) {
|
|
70
|
+
const words = fullFormPhrase.split(/\s+/);
|
|
71
|
+
let letterIndex = 0;
|
|
72
|
+
|
|
73
|
+
sequenceSteps = words.map((word) => {
|
|
74
|
+
const cleanWord = word.replace(/[^a-zA-Z0-9]/g, '');
|
|
75
|
+
const firstChar = cleanWord.charAt(0).toUpperCase();
|
|
76
|
+
|
|
77
|
+
if (letterIndex < letters.length && firstChar === letters[letterIndex]) {
|
|
78
|
+
const currentHighlight = letterIndex;
|
|
79
|
+
letterIndex++;
|
|
80
|
+
return { highlightIndex: currentHighlight, word };
|
|
81
|
+
} else {
|
|
82
|
+
return { highlightIndex: null, word };
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Fallback sequence steps if no fullform supplied
|
|
89
|
+
if (sequenceSteps.length === 0) {
|
|
90
|
+
sequenceSteps = letters.map((letter, idx) => ({
|
|
91
|
+
highlightIndex: idx,
|
|
92
|
+
word: letter
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Prompt 3: Theme Accent Color (Default: #ea580c)
|
|
97
|
+
console.log('\nPreset colors available: orange, blue, emerald, purple, crimson');
|
|
98
|
+
const colorInput = await askQuestion('Primary theme accent color (hex e.g. #ea580c or preset name) [default: #ea580c]: ');
|
|
99
|
+
const colorChoice = colorInput.trim().toLowerCase();
|
|
100
|
+
|
|
101
|
+
let themeColor = '#ea580c';
|
|
102
|
+
let themeSecondary = '#f97316';
|
|
103
|
+
|
|
104
|
+
if (PRESET_COLORS[colorChoice]) {
|
|
105
|
+
themeColor = PRESET_COLORS[colorChoice].primary;
|
|
106
|
+
themeSecondary = PRESET_COLORS[colorChoice].secondary;
|
|
107
|
+
} else if (colorChoice.startsWith('#')) {
|
|
108
|
+
themeColor = colorChoice;
|
|
109
|
+
themeSecondary = colorChoice;
|
|
110
|
+
} else if (/^[0-9a-fA-F]{6}$/.test(colorChoice)) {
|
|
111
|
+
themeColor = `#${colorChoice}`;
|
|
112
|
+
themeSecondary = `#${colorChoice}`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Build configuration object
|
|
116
|
+
const config = {
|
|
117
|
+
platformName,
|
|
118
|
+
themeColor,
|
|
119
|
+
themeSecondary,
|
|
120
|
+
fullForm: fullFormPhrase,
|
|
121
|
+
sequenceSteps
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Determine root directory and target config path
|
|
125
|
+
const projectRoot = path.resolve(__dirname, '..');
|
|
126
|
+
const targetConfigPath = path.join(projectRoot, 'src', 'uai.config.json');
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
fs.writeFileSync(targetConfigPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
130
|
+
console.log('\n====================================================');
|
|
131
|
+
console.log(`✔ Successfully configured platform: ${platformName}`);
|
|
132
|
+
console.log(`✔ Theme color set to: ${themeColor}`);
|
|
133
|
+
console.log(`✔ Target URL fixed to: https://unifiedadministrativeinterface.web.app`);
|
|
134
|
+
console.log(`✔ Configuration saved to: src/uai.config.json`);
|
|
135
|
+
console.log('====================================================\n');
|
|
136
|
+
console.log('Next steps:');
|
|
137
|
+
console.log(' npm run dev # Launch local preview server');
|
|
138
|
+
console.log(' npm run build # Compile for production deployment\n');
|
|
139
|
+
} catch (err) {
|
|
140
|
+
console.error('❌ Failed to save configuration:', err);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
rl.close();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
main();
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:before,:after{box-sizing:border-box;margin:0;padding:0}html,body,#root{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#fff;width:100%;height:100dvh;margin:0;padding:0;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;overflow:hidden}
|