mobile sign-in btn, save msg draft, more subtle error
Some checks are pending
continuous-integration/drone/push Build is running
Some checks are pending
continuous-integration/drone/push Build is running
This commit is contained in:
parent
4e1cfddf88
commit
f966586ae8
@ -1,6 +1,7 @@
|
|||||||
import { OfflineError } from "@snort/shared";
|
import { OfflineError } from "@snort/shared";
|
||||||
import { Offline } from "./Offline";
|
import { Offline } from "./Offline";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
import Icon from "@/Icons/Icon";
|
||||||
|
|
||||||
export function ErrorOrOffline({
|
export function ErrorOrOffline({
|
||||||
error,
|
error,
|
||||||
@ -14,6 +15,11 @@ export function ErrorOrOffline({
|
|||||||
if (error instanceof OfflineError) {
|
if (error instanceof OfflineError) {
|
||||||
return <Offline onRetry={onRetry} className={className} />;
|
return <Offline onRetry={onRetry} className={className} />;
|
||||||
} else {
|
} else {
|
||||||
return <b className={classNames("error", className)}>{error.message}</b>;
|
return (
|
||||||
|
<div className={classNames("flex flex-row items-center px-4 py-3 gap-2", className)}>
|
||||||
|
<Icon name="alert-circle" size={24} />
|
||||||
|
<b>{error.message}</b>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import ProfileImage from "@/Element/User/ProfileImage";
|
|||||||
import useFileUpload from "@/Upload";
|
import useFileUpload from "@/Upload";
|
||||||
import Note from "@/Element/Event/Note";
|
import Note from "@/Element/Event/Note";
|
||||||
|
|
||||||
import { ClipboardEventHandler, DragEvent } from "react";
|
import { ClipboardEventHandler, DragEvent, useEffect } from "react";
|
||||||
import useLogin from "@/Hooks/useLogin";
|
import useLogin from "@/Hooks/useLogin";
|
||||||
import { GetPowWorker } from "@/index";
|
import { GetPowWorker } from "@/index";
|
||||||
import AsyncButton from "@/Element/Button/AsyncButton";
|
import AsyncButton from "@/Element/Button/AsyncButton";
|
||||||
@ -37,6 +37,13 @@ export function NoteCreator() {
|
|||||||
const note = useNoteCreator();
|
const note = useNoteCreator();
|
||||||
const relays = login.relays;
|
const relays = login.relays;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const draft = localStorage.getItem("msgDraft");
|
||||||
|
if (draft) {
|
||||||
|
note.update(n => (n.note = draft));
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
async function buildNote() {
|
async function buildNote() {
|
||||||
try {
|
try {
|
||||||
note.update(v => (v.error = ""));
|
note.update(v => (v.error = ""));
|
||||||
@ -165,6 +172,7 @@ export function NoteCreator() {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
note.update(n => n.reset());
|
note.update(n => n.reset());
|
||||||
|
localStorage.removeItem("msgDraft");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,6 +236,7 @@ export function NoteCreator() {
|
|||||||
function onChange(ev: React.ChangeEvent<HTMLTextAreaElement>) {
|
function onChange(ev: React.ChangeEvent<HTMLTextAreaElement>) {
|
||||||
const { value } = ev.target;
|
const { value } = ev.target;
|
||||||
note.update(n => (n.note = value));
|
note.update(n => (n.note = value));
|
||||||
|
localStorage.setItem("msgDraft", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
@ -647,7 +656,6 @@ export function NoteCreator() {
|
|||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
note.update(v => {
|
note.update(v => {
|
||||||
v.reset();
|
|
||||||
v.show = false;
|
v.show = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ const Timeline = (props: TimelineProps) => {
|
|||||||
displayAs={displayAs}
|
displayAs={displayAs}
|
||||||
/>
|
/>
|
||||||
{(props.loadMore === undefined || props.loadMore === true) && (
|
{(props.loadMore === undefined || props.loadMore === true) && (
|
||||||
<div className="flex items-center">
|
<div className="flex items-center px-3 py-4">
|
||||||
<button type="button" onClick={() => feed.loadMore()}>
|
<button type="button" onClick={() => feed.loadMore()}>
|
||||||
<FormattedMessage defaultMessage="Load more" id="00LcfG" />
|
<FormattedMessage defaultMessage="Load more" id="00LcfG" />
|
||||||
</button>
|
</button>
|
||||||
|
@ -71,6 +71,7 @@ export function logout(id: string) {
|
|||||||
FollowsFeed.clear();
|
FollowsFeed.clear();
|
||||||
Chats.clear();
|
Chats.clear();
|
||||||
deleteRefCode();
|
deleteRefCode();
|
||||||
|
localStorage.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function markNotificationsRead(state: LoginSession) {
|
export function markNotificationsRead(state: LoginSession) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { base64 } from "@scure/base";
|
import { base64 } from "@scure/base";
|
||||||
import { unwrap } from "@snort/shared";
|
import { unwrap } from "@snort/shared";
|
||||||
import { FormattedMessage } from "react-intl";
|
|
||||||
import Icon from "@/Icons/Icon";
|
import Icon from "@/Icons/Icon";
|
||||||
import useKeyboardShortcut from "@/Hooks/useKeyboardShortcut";
|
import useKeyboardShortcut from "@/Hooks/useKeyboardShortcut";
|
||||||
import { isFormElement } from "@/SnortUtils";
|
import { isFormElement } from "@/SnortUtils";
|
||||||
@ -63,8 +62,8 @@ const NotificationsHeader = () => {
|
|||||||
|
|
||||||
if (!publicKey) {
|
if (!publicKey) {
|
||||||
return (
|
return (
|
||||||
<button type="button" className="mr-3" onClick={() => navigate("/login/sign-up")}>
|
<button onClick={() => navigate("/login/sign-up")} className="mr-3 primary p-2">
|
||||||
<FormattedMessage defaultMessage="Sign Up" id="39AHJm" />
|
<Icon name="sign-in" size={20} className="md:hidden" />
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -647,10 +647,6 @@ div.form-col {
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error {
|
|
||||||
color: var(--error);
|
|
||||||
}
|
|
||||||
|
|
||||||
.warning {
|
.warning {
|
||||||
color: var(--warning);
|
color: var(--warning);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user