Skip to content

Commit 54ee2f1

Browse files
committed
chore: run format and lint
1 parent 5d3c0a2 commit 54ee2f1

5 files changed

Lines changed: 284 additions & 282 deletions

File tree

scripts/build.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
//@ts-check
2-
import { createBuilder, createFxmanifest } from '@overextended/fx-utils';
3-
4-
const watch = process.argv.includes('--watch');
5-
6-
createBuilder(
7-
watch,
8-
{
9-
dropLabels: !watch ? ['DEV'] : undefined,
10-
},
11-
[
12-
{
13-
name: 'server',
14-
options: {
15-
platform: 'node',
16-
target: ['node22'],
17-
format: 'cjs',
18-
},
19-
},
20-
{
21-
name: 'client',
22-
options: {
23-
platform: 'browser',
24-
target: ['es2023'],
25-
format: 'iife',
26-
},
27-
},
28-
],
29-
async (outfiles) => {
30-
await createFxmanifest({
31-
client_scripts: [outfiles.client],
32-
server_scripts: [outfiles.server],
33-
dependencies: ['/server:7290', '/onesync', '/server:12913'],
34-
});
35-
}
36-
);
1+
//@ts-check
2+
import { createBuilder, createFxmanifest } from '@overextended/fx-utils';
3+
4+
const watch = process.argv.includes('--watch');
5+
6+
createBuilder(
7+
watch,
8+
{
9+
dropLabels: !watch ? ['DEV'] : undefined,
10+
},
11+
[
12+
{
13+
name: 'server',
14+
options: {
15+
platform: 'node',
16+
target: ['node22'],
17+
format: 'cjs',
18+
},
19+
},
20+
{
21+
name: 'client',
22+
options: {
23+
platform: 'browser',
24+
target: ['es2023'],
25+
format: 'iife',
26+
},
27+
},
28+
],
29+
async (outfiles) => {
30+
await createFxmanifest({
31+
client_scripts: [outfiles.client],
32+
server_scripts: [outfiles.server],
33+
dependencies: ['/server:7290', '/onesync', '/server:12913'],
34+
});
35+
}
36+
);

src/client/index.ts

Lines changed: 157 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,157 @@
1-
import { inputDialog, registerContext, showContext, triggerServerCallback } from '@overextended/ox_lib/client';
2-
3-
interface ReportData {
4-
reportId: number;
5-
player: number;
6-
target: number;
7-
playerName: string;
8-
report: string;
9-
}
10-
11-
interface ContextOption {
12-
title: string;
13-
description?: string;
14-
icon?: string;
15-
onSelect?: (data: ReportData) => void;
16-
args?: ReportData;
17-
disabled?: boolean;
18-
}
19-
20-
const reportOptions = (data: ReportData) => {
21-
registerContext({
22-
id: `sync_reports:options_${data.reportId}`,
23-
title: `Report: ${data.reportId}`,
24-
options: [
25-
{
26-
title: 'Resolve Report',
27-
icon: 'check',
28-
onSelect: () => {
29-
emitNet('sync_reports:resolveReport', data.reportId);
30-
},
31-
},
32-
{
33-
title: 'Open Player In txAdmin',
34-
icon: 'https://raw.githubusercontent.com/tabarra/txAdmin/refs/heads/master/panel/public/favicon_online.svg',
35-
onSelect: () => {
36-
ExecuteCommand(`tx ${data.player}`);
37-
},
38-
},
39-
{
40-
title: 'Open Target In txAdmin',
41-
icon: 'https://raw.githubusercontent.com/tabarra/txAdmin/refs/heads/master/panel/public/favicon_online.svg',
42-
onSelect: () => {
43-
ExecuteCommand(`tx ${data.target || data.player}`);
44-
},
45-
},
46-
],
47-
});
48-
showContext(`sync_reports:options_${data.reportId}`);
49-
};
50-
51-
const fetchActive = async () => {
52-
const activeOptions: ContextOption[] = [];
53-
const response: ReportData[] = await triggerServerCallback('sync_reports:fetchActive', 0) as ReportData[];
54-
if (response.length === 0) {
55-
activeOptions.push({
56-
title: 'No Active Reports',
57-
description: 'Any active reports have been actioned or resolved. Keep doing a good job.',
58-
icon: 'hammer',
59-
disabled: true,
60-
});
61-
} else {
62-
response.map((report: ReportData) => {
63-
activeOptions.push({
64-
title: `[${report.reportId}] ${report.playerName}`,
65-
description: `${report.report}`,
66-
icon: 'hammer',
67-
onSelect: reportOptions,
68-
args: report,
69-
});
70-
});
71-
}
72-
73-
registerContext({
74-
id: 'sync_reports:active',
75-
title: 'Active Reports',
76-
menu: 'sync_reports:main',
77-
options: activeOptions,
78-
});
79-
showContext('sync_reports:active');
80-
};
81-
82-
const fetchHistory = async () => {
83-
const historyOptions: ContextOption[] = [];
84-
const response: ReportData[] = await triggerServerCallback('sync_reports:fetchHistory', 0) as ReportData[];
85-
if (response.length === 0) {
86-
historyOptions.push({
87-
title: 'No Past Reports To Display',
88-
icon: 'clock-rotate-left',
89-
disabled: true,
90-
});
91-
} else {
92-
response.map((report: ReportData) => {
93-
historyOptions.push({
94-
title: `[${report.reportId}] ${report.playerName}`,
95-
description: `${report.report}`,
96-
icon: 'hammer',
97-
disabled: true,
98-
});
99-
})
100-
}
101-
registerContext({
102-
id: 'sync_reports:history',
103-
title: 'Report History',
104-
menu: 'sync_reports:main',
105-
options: historyOptions,
106-
});
107-
showContext('sync_reports:history');
108-
};
109-
110-
registerContext({
111-
id: 'sync_reports:main',
112-
title: 'Reports',
113-
options: [
114-
{
115-
title: 'Active Reports',
116-
icon: 'circle-exclamation',
117-
onSelect: fetchActive,
118-
},
119-
{
120-
title: 'Report History',
121-
icon: 'clock-rotate-left',
122-
onSelect: fetchHistory,
123-
},
124-
],
125-
});
126-
127-
const openMenu = () => {
128-
showContext('sync_reports:main');
129-
};
130-
131-
onNet('sync_reports:openMenu', openMenu);
132-
133-
RegisterCommand('report', async () => {
134-
const reportData: [string, number] = await inputDialog(
135-
'Report Issue',
136-
[
137-
{
138-
type: 'textarea',
139-
label: 'Report',
140-
description: 'Please provide a detailed description of what you want to report.',
141-
required: true,
142-
},
143-
{
144-
type: 'number',
145-
label: 'Target Player ID',
146-
description: 'If you are reporting another player, please provide their ID.',
147-
required: false,
148-
},
149-
],
150-
{ allowCancel: true }
151-
) as [string, number];
152-
emitNet('sync_reports:addReport', reportData[0], reportData[1]);
153-
}, false);
1+
import { inputDialog, registerContext, showContext, triggerServerCallback } from '@overextended/ox_lib/client';
2+
3+
interface ReportData {
4+
reportId: number;
5+
player: number;
6+
target: number;
7+
playerName: string;
8+
report: string;
9+
}
10+
11+
interface ContextOption {
12+
title: string;
13+
description?: string;
14+
icon?: string;
15+
onSelect?: (data: ReportData) => void;
16+
args?: ReportData;
17+
disabled?: boolean;
18+
}
19+
20+
const reportOptions = (data: ReportData) => {
21+
registerContext({
22+
id: `sync_reports:options_${data.reportId}`,
23+
title: `Report: ${data.reportId}`,
24+
options: [
25+
{
26+
title: 'Resolve Report',
27+
icon: 'check',
28+
onSelect: () => {
29+
emitNet('sync_reports:resolveReport', data.reportId);
30+
},
31+
},
32+
{
33+
title: 'Open Player In txAdmin',
34+
icon: 'https://raw.githubusercontent.com/tabarra/txAdmin/refs/heads/master/panel/public/favicon_online.svg',
35+
onSelect: () => {
36+
ExecuteCommand(`tx ${data.player}`);
37+
},
38+
},
39+
{
40+
title: 'Open Target In txAdmin',
41+
icon: 'https://raw.githubusercontent.com/tabarra/txAdmin/refs/heads/master/panel/public/favicon_online.svg',
42+
onSelect: () => {
43+
ExecuteCommand(`tx ${data.target || data.player}`);
44+
},
45+
},
46+
],
47+
});
48+
showContext(`sync_reports:options_${data.reportId}`);
49+
};
50+
51+
const fetchActive = async () => {
52+
const activeOptions: ContextOption[] = [];
53+
const response: ReportData[] = (await triggerServerCallback('sync_reports:fetchActive', 0)) as ReportData[];
54+
if (response.length === 0) {
55+
activeOptions.push({
56+
title: 'No Active Reports',
57+
description: 'Any active reports have been actioned or resolved. Keep doing a good job.',
58+
icon: 'hammer',
59+
disabled: true,
60+
});
61+
} else {
62+
response.map((report: ReportData) => {
63+
activeOptions.push({
64+
title: `[${report.reportId}] ${report.playerName}`,
65+
description: `${report.report}`,
66+
icon: 'hammer',
67+
onSelect: reportOptions,
68+
args: report,
69+
});
70+
});
71+
}
72+
73+
registerContext({
74+
id: 'sync_reports:active',
75+
title: 'Active Reports',
76+
menu: 'sync_reports:main',
77+
options: activeOptions,
78+
});
79+
showContext('sync_reports:active');
80+
};
81+
82+
const fetchHistory = async () => {
83+
const historyOptions: ContextOption[] = [];
84+
const response: ReportData[] = (await triggerServerCallback('sync_reports:fetchHistory', 0)) as ReportData[];
85+
if (response.length === 0) {
86+
historyOptions.push({
87+
title: 'No Past Reports To Display',
88+
icon: 'clock-rotate-left',
89+
disabled: true,
90+
});
91+
} else {
92+
response.map((report: ReportData) => {
93+
historyOptions.push({
94+
title: `[${report.reportId}] ${report.playerName}`,
95+
description: `${report.report}`,
96+
icon: 'hammer',
97+
disabled: true,
98+
});
99+
});
100+
}
101+
registerContext({
102+
id: 'sync_reports:history',
103+
title: 'Report History',
104+
menu: 'sync_reports:main',
105+
options: historyOptions,
106+
});
107+
showContext('sync_reports:history');
108+
};
109+
110+
registerContext({
111+
id: 'sync_reports:main',
112+
title: 'Reports',
113+
options: [
114+
{
115+
title: 'Active Reports',
116+
icon: 'circle-exclamation',
117+
onSelect: fetchActive,
118+
},
119+
{
120+
title: 'Report History',
121+
icon: 'clock-rotate-left',
122+
onSelect: fetchHistory,
123+
},
124+
],
125+
});
126+
127+
const openMenu = () => {
128+
showContext('sync_reports:main');
129+
};
130+
131+
onNet('sync_reports:openMenu', openMenu);
132+
133+
RegisterCommand(
134+
'report',
135+
async () => {
136+
const reportData: [string, number] = (await inputDialog(
137+
'Report Issue',
138+
[
139+
{
140+
type: 'textarea',
141+
label: 'Report',
142+
description: 'Please provide a detailed description of what you want to report.',
143+
required: true,
144+
},
145+
{
146+
type: 'number',
147+
label: 'Target Player ID',
148+
description: 'If you are reporting another player, please provide their ID.',
149+
required: false,
150+
},
151+
],
152+
{ allowCancel: true }
153+
)) as [string, number];
154+
emitNet('sync_reports:addReport', reportData[0], reportData[1]);
155+
},
156+
false
157+
);

0 commit comments

Comments
 (0)