notify
This commit is contained in:
1 parent
b86a4216cf
commit
b91f877045
11 files changed
+118
-130
No files matched your search
@@ -1,12 +1,10 @@
|
||||
import { h } from 'preact';
|
||||
import { useState, useCallback } from 'preact/hooks';
|
||||
import { useState } from 'preact/hooks';
|
||||
import { ExternalLink } from 'react-feather';
|
||||
|
||||
import { useSelector } from 'react-redux'
|
||||
import { State } from './../store'
|
||||
|
||||
import http from './../http';
|
||||
|
||||
function Want(want) {
|
||||
const r = want.data;
|
||||
|
||||
@@ -14,10 +12,13 @@ function Want(want) {
|
||||
const [confirm, setConfirm] = useState(false);
|
||||
|
||||
function onClick() {
|
||||
if (confirm) return ws.sendWantRm(want.id);
|
||||
if (confirm) {
|
||||
setConfirm(false);
|
||||
return ws.sendWantRm(want.id);
|
||||
}
|
||||
setTimeout(() => setConfirm(false), 2500);
|
||||
return setConfirm(true);
|
||||
};
|
||||
}
|
||||
|
||||
const text = confirm
|
||||
? 'confirm'
|
||||
|
||||
@@ -10,7 +10,6 @@ import Want from './../components/want';
|
||||
|
||||
const List = () => {
|
||||
const wants = useSelector((state: State) => state.wants);
|
||||
const user = useSelector((state: State) => state.user);
|
||||
|
||||
if (!wants) {
|
||||
return <div> loading... </div>;
|
||||
|
||||
@@ -378,19 +378,16 @@ a {
|
||||
}
|
||||
}
|
||||
|
||||
nav {
|
||||
a {
|
||||
font-size: var(--small-font-size);
|
||||
margin-right: var(--spacing);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
header {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr min-content;
|
||||
padding-bottom: var(--spacing);
|
||||
|
||||
a {
|
||||
font-size: var(--small-font-size);
|
||||
margin-right: var(--spacing);
|
||||
}
|
||||
|
||||
a {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import toast from 'izitoast';
|
||||
export function info(title, message) {
|
||||
toast.info({
|
||||
title,
|
||||
message,
|
||||
message: message || '',
|
||||
position: 'bottomCenter',
|
||||
color: '#1f2128',
|
||||
titleColor: '#F4F1D0',
|
||||
|
||||
+3
-1
@@ -1,5 +1,6 @@
|
||||
import { wantsState, wsState, userState, offersState, acpOffersState } from './store'
|
||||
import debounce from 'lodash/debounce';
|
||||
|
||||
import { wantsState, userState, offersState, acpOffersState } from './store'
|
||||
import * as toast from './toast';
|
||||
|
||||
const SOCKET_URL = `${window.location.protocol === 'https:' ? 'wss://' : 'ws://'}${window.location.host}/api/ws`;
|
||||
@@ -116,6 +117,7 @@ export default function createSocket(dispatch) {
|
||||
// Connection opened
|
||||
function onOpen() {
|
||||
console.log('websocket connected', SOCKET_URL)
|
||||
toast.info('connected', 'connected to server');
|
||||
sendPing();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user