mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 23:46:03 +01:00
fix(nui): Make description optional
This commit is contained in:
@@ -12,7 +12,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title?: string;
|
title?: string;
|
||||||
description: string;
|
description?: string;
|
||||||
duration?: number;
|
duration?: number;
|
||||||
position?: ToastPositionWithLogical;
|
position?: ToastPositionWithLogical;
|
||||||
status?: "info" | "warning" | "success" | "error";
|
status?: "info" | "warning" | "success" | "error";
|
||||||
@@ -21,7 +21,7 @@ interface Props {
|
|||||||
|
|
||||||
interface CustomProps {
|
interface CustomProps {
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
description: string;
|
description?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
duration?: number;
|
duration?: number;
|
||||||
icon?: IconProp;
|
icon?: IconProp;
|
||||||
@@ -47,7 +47,6 @@ debugData<CustomProps>([
|
|||||||
action: "customNotify",
|
action: "customNotify",
|
||||||
data: {
|
data: {
|
||||||
description: "Dunak is nerd",
|
description: "Dunak is nerd",
|
||||||
title: "Dunak",
|
|
||||||
icon: "basket-shopping",
|
icon: "basket-shopping",
|
||||||
style: {
|
style: {
|
||||||
backgroundColor: "#2D3748",
|
backgroundColor: "#2D3748",
|
||||||
@@ -61,6 +60,7 @@ const Notifications: React.FC = () => {
|
|||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
|
|
||||||
useNuiEvent<CustomProps>("customNotify", (data) => {
|
useNuiEvent<CustomProps>("customNotify", (data) => {
|
||||||
|
if (!data.title && !data.description) return;
|
||||||
if (data.id && toast.isActive(data.id)) return;
|
if (data.id && toast.isActive(data.id)) return;
|
||||||
if (!data.icon) {
|
if (!data.icon) {
|
||||||
data.icon =
|
data.icon =
|
||||||
@@ -102,6 +102,7 @@ const Notifications: React.FC = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useNuiEvent<Props>("notify", (data) => {
|
useNuiEvent<Props>("notify", (data) => {
|
||||||
|
if (!data.title && !data.description) return;
|
||||||
if (data.id && toast.isActive(data.id)) return;
|
if (data.id && toast.isActive(data.id)) return;
|
||||||
toast({
|
toast({
|
||||||
title: data.title,
|
title: data.title,
|
||||||
|
|||||||
Reference in New Issue
Block a user