From 403c0406f324a2a8336ecb1c742a6021774e20d0 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Wed, 24 Jan 2024 01:02:23 +0100 Subject: [PATCH] refactor: formatting(all): Format with prettier and lua formatter --- .github/CHANGELOG.md | 3 +- .../resources/[esx]/esx_notify/LICENSE | 4 +-- .../resources/[esx]/esx_notify/Notify.lua | 13 ++++----- .../resources/[esx]/esx_notify/fxmanifest.lua | 2 +- .../[esx]/esx_notify/nui/css/style.css | 28 ++++++++----------- .../resources/[esx]/esx_notify/nui/index.html | 26 ++++++++--------- .../[esx]/esx_notify/nui/js/script.js | 18 ++++++------ .../resources/[esx]/esx_notify/readme.md | 4 +-- 8 files changed, 47 insertions(+), 51 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 49587e6d7..0b35d830a 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -99,4 +99,5 @@ fix lint error: unused argument last; accessing undefined variable Invoke; unuse 73. [esx_context]: chore: esx_context update to version 1.0.0 @bitpredator 74. [esx_menu_default]: chore: esx_menu_default update to version 1.0.0 @bitpredator 75. [esx_multicharacter]: refactor: esx_multicharacter @bitpredator -76. [esx_multicharacter]: fix: fixed problem which prevented the menu from opening @bitpredator \ No newline at end of file +76. [esx_multicharacter]: fix: fixed problem which prevented the menu from opening @bitpredator +77. [esx_notify]: refactor: formatting(all): Format with prettier and lua formatter @bitpredator \ No newline at end of file diff --git a/server-data/resources/[esx]/esx_notify/LICENSE b/server-data/resources/[esx]/esx_notify/LICENSE index e6be23fde..803b49f15 100644 --- a/server-data/resources/[esx]/esx_notify/LICENSE +++ b/server-data/resources/[esx]/esx_notify/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. esx_menu_default - Copyright (C) 2015-2023 + Copyright (C) 2015-2024 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - esx_menu_default Copyright (C) 2015-2023 + esx_menu_default Copyright (C) 2015-2024 This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/server-data/resources/[esx]/esx_notify/Notify.lua b/server-data/resources/[esx]/esx_notify/Notify.lua index f1798c720..656b378c8 100644 --- a/server-data/resources/[esx]/esx_notify/Notify.lua +++ b/server-data/resources/[esx]/esx_notify/Notify.lua @@ -4,11 +4,10 @@ local Debug = ESX.GetConfig().EnableDebug ---@param length number the length of the notification ---@param message any the message :D local function Notify(notificatonType, length, message) - if Debug then - print("1 ".. tostring(notificatonType)) - print("2 "..tostring(length)) - print("3 "..message) + print(('1 %s'):format(tostring(notificatonType))) + print(('2 %s'):format(tostring(length))) + print(('3 %s'):format(message)) end if type(notificatonType) ~= "string" then @@ -20,9 +19,9 @@ local function Notify(notificatonType, length, message) end if Debug then - print("4 ".. tostring(notificatonType)) - print("5 "..tostring(length)) - print("6 "..message) + print(('4 %s'):format(tostring(notificatonType))) + print(('5 %s'):format(tostring(length))) + print(('6 %s'):format(message)) end SendNuiMessage(json.encode({ diff --git a/server-data/resources/[esx]/esx_notify/fxmanifest.lua b/server-data/resources/[esx]/esx_notify/fxmanifest.lua index a6ef12d28..58d938a7d 100644 --- a/server-data/resources/[esx]/esx_notify/fxmanifest.lua +++ b/server-data/resources/[esx]/esx_notify/fxmanifest.lua @@ -1,7 +1,7 @@ fx_version 'adamant' lua54 'yes' game 'gta5' -version '0.0.4' +version '1.0.0' author 'ESX-Framework' description 'Official NUI Notification system for ESX' diff --git a/server-data/resources/[esx]/esx_notify/nui/css/style.css b/server-data/resources/[esx]/esx_notify/nui/css/style.css index e86093e32..799e3c268 100644 --- a/server-data/resources/[esx]/esx_notify/nui/css/style.css +++ b/server-data/resources/[esx]/esx_notify/nui/css/style.css @@ -1,4 +1,4 @@ -@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100&family=Poppins:wght@300;400;500;600;800&display=swap'); +@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@100&family=Poppins:wght@300;400;500;600;800&display=swap"); :root { --color: #919191; @@ -16,7 +16,7 @@ body { height: 100vh; color: var(--color); font-weight: 100; - font-family: 'Poppins', sans-serif; + font-family: "Poppins", sans-serif; overflow: hidden; } @@ -32,16 +32,16 @@ body { min-width: 20rem; width: fit-content; height: 3.5rem; - background: rgba(5,5, 5, 0.9); - border-radius: .5rem; - margin-top: .5rem; + background: rgba(5, 5, 5, 0.9); + border-radius: 0.5rem; + margin-top: 0.5rem; animation: anim 300ms ease-in-out; align-items: center; } #root .innerText { - padding-left: .4rem; - padding-right: .4rem; + padding-left: 0.4rem; + padding-right: 0.4rem; width: 100%; } @@ -52,7 +52,7 @@ body { #root .text { display: inline-block; - margin-left: .5rem; + margin-left: 0.5rem; } #root .error { @@ -68,11 +68,7 @@ body { } .material-symbols-outlined { - font-variation-settings: - 'FILL' 0, - 'wght' 400, - 'GRAD' 0, - 'opsz' 48 + font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 48; } @keyframes anim { @@ -80,9 +76,9 @@ body { transform: scaleY(0); } 80% { - transform: scaleY(1.1) + transform: scaleY(1.1); } 100% { - transform: scaleY(1) + transform: scaleY(1); } -} +} \ No newline at end of file diff --git a/server-data/resources/[esx]/esx_notify/nui/index.html b/server-data/resources/[esx]/esx_notify/nui/index.html index 2852ba798..d35e3a913 100644 --- a/server-data/resources/[esx]/esx_notify/nui/index.html +++ b/server-data/resources/[esx]/esx_notify/nui/index.html @@ -1,15 +1,15 @@ - - - - - - ESX Notify - - -
- -
- - + + + + + + ESX Notify + + +
+ +
+ + \ No newline at end of file diff --git a/server-data/resources/[esx]/esx_notify/nui/js/script.js b/server-data/resources/[esx]/esx_notify/nui/js/script.js index 55591a8aa..d700017c6 100644 --- a/server-data/resources/[esx]/esx_notify/nui/js/script.js +++ b/server-data/resources/[esx]/esx_notify/nui/js/script.js @@ -1,4 +1,4 @@ -const w = window +const w = window; // Gets the current icon it needs to use. const types = { @@ -10,8 +10,8 @@ const types = { }, ["info"]: { ["icon"]: "info", - } -} + }, +}; // the color codes example `i ~r~love~s~ donuts` const codes = { @@ -23,8 +23,8 @@ const codes = { "~c~": "grey", "~m~": "#212121", "~u~": "black", - "~o~": "orange" -} + "~o~": "orange", +}; w.addEventListener("message", (event) => { notification({ @@ -41,8 +41,8 @@ const replaceColors = (str, obj) => { strToReplace = strToReplace.replace(new RegExp(id, "g"), obj[id]); } - return strToReplace -} + return strToReplace; +}; notification = (data) => { for (color in codes) { @@ -53,7 +53,7 @@ notification = (data) => { let newStr = replaceColors(data["message"], objArr); - data["message"] = newStr + data["message"] = newStr; } } @@ -71,4 +71,4 @@ notification = (data) => { }, data.length); return notification; -} +}; \ No newline at end of file diff --git a/server-data/resources/[esx]/esx_notify/readme.md b/server-data/resources/[esx]/esx_notify/readme.md index 366370f14..3d064cacf 100644 --- a/server-data/resources/[esx]/esx_notify/readme.md +++ b/server-data/resources/[esx]/esx_notify/readme.md @@ -53,10 +53,10 @@ ESX.ShowNotification("I i ~r~love~s~ donuts", "success", 3000) esx_notify- Notify! -Copyright (C) 2023 +Copyright (C) 2023-2024 This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details. -You should have received a copy Of the GNU General Public License along with this program. If Not, see . +You should have received a copy Of the GNU General Public License along with this program. If Not, see . \ No newline at end of file