Skip to content

Commit 26a6133

Browse files
committed
feat: integra @mriqbox/ui-kit + accent suite-wide via convar mri:color
Fase 1 da integracao com a suite MRI. Sem mudanca visual, prepara o terreno: ui-kit instalado, tokens shadcn alinhados, accent global reagindo a convar mri:color em runtime. Frontend (web/): - package.json: dep @mriqbox/ui-kit ^4.10.1 - src/index.css: import do CSS do kit + tokens shadcn completos (--primary/--ring/--card/etc). Default --primary = 160 100% 45% (#00E699, accent canonico da suite). Legados --ps-hud-* mantidos ate migracao dos componentes do menu antigo. - tailwind.config: darkMode class, tokens consumindo CSS vars, content path incluindo node_modules/@mriqbox/ui-kit/dist (JIT pega classes usadas dentro do kit) - stores/themeStore.ts (novo): zustand store com accentColor + setter validador (so aceita hex #RRGGBB ou #RRGGBBAA) - hooks/useAccentColor.ts (novo): converte hex -> HSL e aplica em --primary + --ring. Padrao identico ao Qspawn/Qadmin/Qappearance. - App.tsx: wire useThemeStore + useAccentColor no root - utils/eventHandler.ts: 'updateUISettings' agora chama themeStore.setAccentColor se data.accentColor estiver presente (funciona tanto pra payload completo quanto so com accent) Lua (client/main.lua): - getMriAccent() le convar mri:color (default #00E699), valida hex - sendUIUpdateMessage inclui accentColor em todo payload - AddConvarChangeListener('mri:color') broadcasta updateUISettings parcial com novo accent, sem precisar restart do resource - Event handler 'mri:color:changed' tambem suportado (compat com emissor externo) Build artifacts (html/index.css cresce de ~14kb pra ~85kb por causa dos tokens + tailwind base + CSS do kit — esperado). Proximos passos (separados): migrar componentes do menu antigo pra MriButton/MriCard/MriSwitch do kit (Fase 2, opcional).
1 parent c3df847 commit 26a6133

12 files changed

Lines changed: 963 additions & 26 deletions

File tree

client/main.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,22 @@ local function SendAdminStatus()
116116
})
117117
end
118118

119+
-- Hex valido (#RRGGBB ou #RRGGBBAA). Convar `mri:color` e a fonte de verdade
120+
-- do accent da suite MRI; cai no default verde-cian (#00E699) se ausente.
121+
local HEX_PATTERN = '^#%x%x%x%x%x%x%x?%x?$'
122+
local function getMriAccent()
123+
local c = GetConvar('mri:color', '#00E699')
124+
if type(c) == 'string' and c:match(HEX_PATTERN) then return c end
125+
return '#00E699'
126+
end
127+
119128
local function sendUIUpdateMessage(data)
120129
SendNUIMessage({
121130
action = 'updateUISettings',
122131
icons = data.icons,
123132
layout = data.layout,
124133
colors = data.colors,
134+
accentColor = getMriAccent(),
125135
})
126136
end
127137

@@ -132,6 +142,17 @@ local function sendUILang()
132142
})
133143
end
134144

145+
-- Convar `mri:color` mudou em runtime — propaga pra NUI sem precisar restart.
146+
-- O eventHandler.ts da NUI escuta 'updateUISettings' e atualiza o themeStore;
147+
-- useAccentColor reage e aplica nas CSS vars --primary/--ring.
148+
AddEventHandler('mri:color:changed', function()
149+
SendNUIMessage({ action = 'updateUISettings', accentColor = getMriAccent() })
150+
end)
151+
AddConvarChangeListener('mri:color', function(name)
152+
if name ~= 'mri:color' then return end
153+
SendNUIMessage({ action = 'updateUISettings', accentColor = getMriAccent() })
154+
end)
155+
135156
local function sendHudConfig()
136157
SendNUIMessage({
137158
action = 'hudconfig',

html/index.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

html/index.js

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"check": "tsc --noEmit"
1111
},
1212
"dependencies": {
13+
"@mriqbox/ui-kit": "^4.10.1",
1314
"@fortawesome/fontawesome-svg-core": "^6.7.2",
1415
"@fortawesome/free-regular-svg-icons": "^6.7.2",
1516
"@fortawesome/free-solid-svg-icons": "^6.7.2",

0 commit comments

Comments
 (0)