Skip to content

Commit

Permalink
feat: add optional icons before group name
Browse files Browse the repository at this point in the history
  • Loading branch information
antond15 committed Dec 22, 2024
1 parent 555a2a7 commit 7fcd62d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ return {
label = 'Police',
groups = {'police', 'sheriff'},
includeOffDuty = false,
icon = 'ic:round-local-police',
},
{
label = 'EMS',
Expand All @@ -64,6 +65,7 @@ return {
label = 'Mechanics',
groups = {'lsc', 'bennys', 'hayes'},
includeOffDuty = true,
icon = 'mdi:wrench',
},
{
label = 'Taxi',
Expand Down
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use_experimental_fxv2_oal 'yes'

name 'ac_scoreboard'
author 'AC Scripts'
version '2.1.0'
version '2.2.0'
description 'A framework-standalone scoreboard UI for FiveM.'
repository 'https://github.com/acscripts/ac_scoreboard'

Expand Down
1 change: 1 addition & 0 deletions modules/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ local function openScoreboard()
groups[index] = {
label = group.label,
count = data.groups[index],
icon = group.icon,
}
end

Expand Down
8 changes: 7 additions & 1 deletion web/src/components/groups.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import Icon from '@iconify/svelte';
import data from '$store/data';
import config from '$store/config';
import locales from '$store/locales';
Expand All @@ -17,7 +18,12 @@
$config.compactGroups ? 'py-1' : 'py-2'
)}
>
<span class="truncate">{group.label}</span>
<div class="flex items-center gap-2 truncate">
{#if group.icon}
<Icon icon={group.icon} class="h-4 min-w-4" />
{/if}
<span class="truncate">{group.label}</span>
</div>
<span
class={cn(
'min-w-9 flex-shrink-0 select-none rounded-md bg-slate-800 px-2 text-center',
Expand Down
4 changes: 2 additions & 2 deletions web/src/store/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export default writable<SheetData>({
maxPlayers: 100,
},
groups: [
{ label: 'Police', count: 7 },
{ label: 'Police', count: 7, icon: 'ic:round-local-police' },
{ label: 'EMS', count: 6 },
{ label: 'Mechanics', count: 2 },
{ label: 'Mechanics', count: 2, icon: 'mdi:wrench' },
{ label: 'Taxi', count: 0 },
{ label: 'Unemployed', count: 47 },
],
Expand Down
1 change: 1 addition & 0 deletions web/src/types/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type Footer = {
type Group = {
label: string;
count: number;
icon?: string;
};

type Player = {
Expand Down

0 comments on commit 7fcd62d

Please sign in to comment.