feat: improve frontend (#387)

* fork

* fork

* chore: update style

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
This commit is contained in:
Yolo°
2023-08-12 10:49:30 +08:00
committed by GitHub
parent be780462f1
commit c58f710227
10 changed files with 98 additions and 26 deletions

View File

@@ -1,6 +1,11 @@
import { toast } from 'react-toastify';
import { toastConstants } from '../constants';
import React from 'react';
const HTMLToastContent = ({ htmlContent }) => {
return <div dangerouslySetInnerHTML={{ __html: htmlContent }} />;
};
export default HTMLToastContent;
export function isAdmin() {
let user = localStorage.getItem('user');
if (!user) return false;
@@ -107,8 +112,12 @@ export function showInfo(message) {
toast.info(message, showInfoOptions);
}
export function showNotice(message) {
toast.info(message, showNoticeOptions);
export function showNotice(message, isHTML = false) {
if (isHTML) {
toast(<HTMLToastContent htmlContent={message} />, showNoticeOptions);
} else {
toast.info(message, showNoticeOptions);
}
}
export function openPage(url) {