new note text in sidebar btn

This commit is contained in:
Martti Malmi 2023-11-22 14:25:43 +02:00
parent e97b9bdba4
commit ced63ab6d1
4 changed files with 21 additions and 3 deletions

View File

@ -9,8 +9,17 @@ import useLogin from "@/Hooks/useLogin";
import Icon from "@/Icons/Icon";
import { useNoteCreator } from "@/State/NoteCreator";
import { NoteCreator } from "./NoteCreator";
import { FormattedMessage } from "react-intl";
export const NoteCreatorButton = ({ className, alwaysShow }: { className?: string; alwaysShow?: boolean }) => {
export const NoteCreatorButton = ({
className,
alwaysShow,
showText,
}: {
className?: string;
alwaysShow?: boolean;
showText?: boolean;
}) => {
const buttonRef = useRef<HTMLButtonElement>(null);
const location = useLocation();
const { readonly } = useLogin(s => ({ readonly: s.readonly }));
@ -51,7 +60,7 @@ export const NoteCreatorButton = ({ className, alwaysShow }: { className?: strin
{!shouldHideNoteCreator && (
<button
ref={buttonRef}
className={classNames("primary circle", className)}
className={classNames("flex flex-row items-center primary rounded-full", { "circle": !showText }, className)}
onClick={() =>
update(v => {
v.replyTo = undefined;
@ -59,6 +68,11 @@ export const NoteCreatorButton = ({ className, alwaysShow }: { className?: strin
})
}>
<Icon name="plus" size={16} />
{showText && (
<span className="ml-2 hidden xl:inline">
<FormattedMessage defaultMessage="New Note" id="2mcwT8" />
</span>
)}
</button>
)}
<NoteCreator key="global-note-creator" />

View File

@ -64,7 +64,7 @@ export default function NavSidebar() {
})}
{publicKey ? (
<div className="mt-2">
<NoteCreatorButton alwaysShow={true} />
<NoteCreatorButton alwaysShow={true} showText={true} />
</div>
) : (
<div className="mt-2">

View File

@ -129,6 +129,9 @@
"2k0Cv+": {
"defaultMessage": "Dislikes ({n})"
},
"2mcwT8": {
"defaultMessage": "New Note"
},
"2ukA4d": {
"defaultMessage": "{n} hours"
},

View File

@ -42,6 +42,7 @@
"2O2sfp": "Finish",
"2a2YiP": "{n} Bookmarks",
"2k0Cv+": "Dislikes ({n})",
"2mcwT8": "New Note",
"2ukA4d": "{n} hours",
"2zJXeA": "Profiles",
"39AHJm": "Sign Up",