-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add list data and truncate table actions
- Loading branch information
Showing
13 changed files
with
114 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
import { For } from "solid-js" | ||
import { useAppSelector } from "../../services/Context" | ||
import { For } from "solid-js"; | ||
import { useAppSelector } from "../../services/Context"; | ||
import { Alert } from "./Alert"; | ||
|
||
export const Alerts = () => { | ||
const { errors: { errors } } = useAppSelector() | ||
const { | ||
messages: { messages }, | ||
} = useAppSelector(); | ||
return ( | ||
<div class="absolute"> | ||
<div class="toast"> | ||
<For each={errors}> | ||
{error => ( | ||
<div class="alert alert-error py-1 px-2 rounded-lg"> | ||
<span class="text-sm font-medium">{error.message}</span> | ||
</div> | ||
<For each={messages}> | ||
{(msg) => ( | ||
<Alert color={msg.type}> | ||
<span class="font-medium">{msg.message}</span> | ||
</Alert> | ||
)} | ||
</For> | ||
</div> | ||
</div> | ||
) | ||
} | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { AlertTypes } from "components/UI"; | ||
import { createStore } from "solid-js/store"; | ||
import { randomId } from "utils/utils"; | ||
|
||
type Error = { | ||
message: string; | ||
id: string; | ||
type: AlertTypes; | ||
}; | ||
|
||
export const MessageService = () => { | ||
const errorStore = createStore<Error[]>([]); | ||
const [messages, setMessages] = errorStore; | ||
|
||
const notify = (message: string | unknown, type: AlertTypes = 'error') => { | ||
const id = randomId(); | ||
setMessages(messages.concat({ message: String(message), id, type })); | ||
|
||
setTimeout(() => { | ||
setMessages(messages.filter((e) => e.id !== id)); | ||
}, 5000); | ||
}; | ||
|
||
return { messages, notify }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters