This commit is contained in:
ntr committed 2022-12-27 15:37:46 +11:00
1 parent b86a4216cf
commit b91f877045
11 files changed
+118 -130

No files matched your search

+6 -5
View File
@@ -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'
-1
View File
@@ -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>;
+5 -8
View File
@@ -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;
}
+1 -1
View File
@@ -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
View File
@@ -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();
}