mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 20:31:13 +00:00
Trying to fix site loading errors. #104
This commit is contained in:
parent
1b8fe6f6e6
commit
3278576927
2 changed files with 48 additions and 42 deletions
|
@ -165,7 +165,7 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
|
||||||
|
|
||||||
// TODO class active corresponding to current page
|
// TODO class active corresponding to current page
|
||||||
navbar() {
|
navbar() {
|
||||||
let user = UserService.Instance.user;
|
let user = this.props.site.my_user;
|
||||||
return (
|
return (
|
||||||
<nav class="navbar navbar-expand-lg navbar-light shadow-sm p-0 px-3">
|
<nav class="navbar navbar-expand-lg navbar-light shadow-sm p-0 px-3">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
|
@ -521,13 +521,15 @@ export function isPostType(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toast(text: string, background: string = 'success') {
|
export function toast(text: string, background: string = 'success') {
|
||||||
let backgroundColor = `var(--${background})`;
|
if (isBrowser()) {
|
||||||
Toastify({
|
let backgroundColor = `var(--${background})`;
|
||||||
text: text,
|
Toastify({
|
||||||
backgroundColor: backgroundColor,
|
text: text,
|
||||||
gravity: 'bottom',
|
backgroundColor: backgroundColor,
|
||||||
position: 'left',
|
gravity: 'bottom',
|
||||||
}).showToast();
|
position: 'left',
|
||||||
|
}).showToast();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pictrsDeleteToast(
|
export function pictrsDeleteToast(
|
||||||
|
@ -535,22 +537,24 @@ export function pictrsDeleteToast(
|
||||||
deletePictureText: string,
|
deletePictureText: string,
|
||||||
deleteUrl: string
|
deleteUrl: string
|
||||||
) {
|
) {
|
||||||
let backgroundColor = `var(--light)`;
|
if (isBrowser()) {
|
||||||
let toast = Toastify({
|
let backgroundColor = `var(--light)`;
|
||||||
text: clickToDeleteText,
|
let toast = Toastify({
|
||||||
backgroundColor: backgroundColor,
|
text: clickToDeleteText,
|
||||||
gravity: 'top',
|
backgroundColor: backgroundColor,
|
||||||
position: 'right',
|
gravity: 'top',
|
||||||
duration: 10000,
|
position: 'right',
|
||||||
onClick: () => {
|
duration: 10000,
|
||||||
if (toast) {
|
onClick: () => {
|
||||||
window.location.replace(deleteUrl);
|
if (toast) {
|
||||||
alert(deletePictureText);
|
window.location.replace(deleteUrl);
|
||||||
toast.hideToast();
|
alert(deletePictureText);
|
||||||
}
|
toast.hideToast();
|
||||||
},
|
}
|
||||||
close: true,
|
},
|
||||||
}).showToast();
|
close: true,
|
||||||
|
}).showToast();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NotifyInfo {
|
interface NotifyInfo {
|
||||||
|
@ -561,25 +565,27 @@ interface NotifyInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function messageToastify(info: NotifyInfo, router: any) {
|
export function messageToastify(info: NotifyInfo, router: any) {
|
||||||
let htmlBody = info.body ? md.render(info.body) : '';
|
if (isBrowser()) {
|
||||||
let backgroundColor = `var(--light)`;
|
let htmlBody = info.body ? md.render(info.body) : '';
|
||||||
|
let backgroundColor = `var(--light)`;
|
||||||
|
|
||||||
let toast = Toastify({
|
let toast = Toastify({
|
||||||
text: `${htmlBody}<br />${info.name}`,
|
text: `${htmlBody}<br />${info.name}`,
|
||||||
avatar: info.icon,
|
avatar: info.icon,
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
className: 'text-dark',
|
className: 'text-dark',
|
||||||
close: true,
|
close: true,
|
||||||
gravity: 'top',
|
gravity: 'top',
|
||||||
position: 'right',
|
position: 'right',
|
||||||
duration: 5000,
|
duration: 5000,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
if (toast) {
|
if (toast) {
|
||||||
toast.hideToast();
|
toast.hideToast();
|
||||||
router.history.push(info.link);
|
router.history.push(info.link);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}).showToast();
|
}).showToast();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function notifyPost(post: Post, router: any) {
|
export function notifyPost(post: Post, router: any) {
|
||||||
|
|
Loading…
Reference in a new issue