Skip to content

Commit

Permalink
finished update
Browse files Browse the repository at this point in the history
  • Loading branch information
mikigoalie committed Nov 4, 2023
1 parent 50d687d commit d526eff
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 26 deletions.
6 changes: 6 additions & 0 deletions client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ RegisterNuiCallback('scoreboard:initialized', function(_, cb)
scoreboard_started = true
scoreboardData.GLOBAL = lib.callback.await('scoreboard:requestInitialData')
scoreboardData.GLOBAL.PLAYER_SOURCE = cache.serverId
scoreboardData.GLOBAL.UI = {
PLAYERS = locale('PLAYERS'),
SOCIETIES = locale('SOCIETIES'),
HIDE = locale('HIDE'),
SHOW = locale('SHOW'),
}
SendNUIMessage({ action = 'scoreboard:update', data = scoreboardData})
end
cb({})
Expand Down
13 changes: 4 additions & 9 deletions locales/cs.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{
"player": "Hráč",
"players": "Hráči",
"society": "Frakce",
"societies": "Frakce",
"employees": "Zaměstnanců",
"serverid": "Server ID",
"player_is_connecting": "Hráč se připojuje",
"scoreboard": "LSRP",
"toggle_alt_name": "Toggle alternative name"
"PLAYERS": "Hráči",
"SOCIETIES": "Frakce",
"HIDE": "Zakrýt",
"SHOW": "Ukázat"
}
2 changes: 1 addition & 1 deletion server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ lib.callback.register('scoreboard:requestUpdate', function(source)
end)

local function start()
Wait(1000)
Wait(500)
ESXJOBS = ESX.GetJobs()
players.initialize()
--societies.initialize()
Expand Down
2 changes: 1 addition & 1 deletion shared/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Config = {}
---@param UI_LEFT_SIDE boolean
Config.server = {
UI_LEFT_SIDE = false,
UI_USE_LOGO = false,
UI_USE_LOGO = true,
UI_TABS = 'both'
}

Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LSRP_Scoreboard</title>
<script type="module" crossorigin src="./assets/index-d7764759.js"></script>
<script type="module" crossorigin src="./assets/index-4b48ef4c.js"></script>
<link rel="stylesheet" href="./assets/index-007ddb0a.css">
</head>
<body>
Expand Down
9 changes: 7 additions & 2 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ const MOCKDATA = {
UI_LEFT_SIDE: false,
UI_USE_LOGO: true,
UI_TABS: "both",
UI: {
PLAYERS: "Hráči",
SOCIETIES: "Frakce",
HIDE: "Hide",
SHOW: "Show"
},
},

PLAYERS: {
1: {
player_name: "Player 1",
Expand Down Expand Up @@ -143,8 +150,6 @@ export default function App() {

fetchNui('scoreboard:initialized')



useNuiEvent("scoreboard:update", (newData: any) => {
setData((data: any) => ({ ...data, ...newData }));
});
Expand Down
5 changes: 3 additions & 2 deletions web/src/pages/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { AiFillEye, AiFillEyeInvisible } from 'react-icons/ai'
export default function Footer({ SCOREBOARD, adminView, setAdminView }: { SCOREBOARD: ScoreboardData; adminView: boolean; setAdminView: any }) {
const playerCount = Object.keys(SCOREBOARD.PLAYERS).length
const maxPlayers = SCOREBOARD.GLOBAL.MAX_PLAYERS;
console.log(JSON.stringify(SCOREBOARD.GLOBAL.UI))

if (!SCOREBOARD.GLOBAL.PLAYER_ADMIN) return (
<div style={{ flex: '0 0 7rem', width: "100%", padding: "1rem" }}>
Expand Down Expand Up @@ -58,9 +59,9 @@ export default function Footer({ SCOREBOARD, adminView, setAdminView }: { SCOREB
<TooltipTrigger>
<Button onClick={() => setAdminView(!adminView)}>
{adminView ?
( <> <AiFillEyeInvisible className="w-4 h-4 mr-2" /> Hide </> )
( <> <AiFillEyeInvisible className="w-4 h-4 mr-2" /> {SCOREBOARD.GLOBAL.UI.HIDE} </> )
:
( <> <AiFillEye className="w-4 h-4 mr-2" /> Show </> )}
( <> <AiFillEye className="w-4 h-4 mr-2" /> {SCOREBOARD.GLOBAL.UI.SHOW} </> )}
</Button>
</TooltipTrigger>
<TooltipContent>
Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/Scoreboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export default function Scoreboard({ SCOREBOARD }: { SCOREBOARD: ScoreboardData
<div style={{ marginBottom: "1rem" }}>
<Tabs defaultValue={"players"} style={{ width: "100%", display: "grid", justifyContent: "center" }} onValueChange={(value) => setTab(value as 'players' | 'societies')} >
<TabsList>
<TabsTrigger value="players">Players</TabsTrigger>
<TabsTrigger value="societies">Society</TabsTrigger>
<TabsTrigger value="players">{SCOREBOARD.GLOBAL.UI.PLAYERS}</TabsTrigger>
<TabsTrigger value="societies">{SCOREBOARD.GLOBAL.UI.SOCIETIES}</TabsTrigger>
</TabsList>
</Tabs>
</div>
Expand Down

0 comments on commit d526eff

Please sign in to comment.