From e85e31a4812a77394591c141a7120ff62d9ad8ba Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 9 Nov 2025 15:32:22 -0500 Subject: [PATCH] chore: UI tweaks (#10606) * chore: Add transition on button mouseout * Change default API key expiration to 1 month * fix: Image upload triggered twice on New Application form * Improve clickarea of sidebar disclosures ref #10482 * Interaction fade --- app/components/Button.tsx | 4 ++ app/components/EditableTitle.tsx | 54 ++++++++++----- .../OAuthClient/OAuthClientForm.tsx | 25 +++---- .../Sidebar/components/Disclosure.tsx | 24 ++----- .../Sidebar/components/SidebarLink.tsx | 65 ++++++++++++------- app/scenes/ApiKeyNew/index.tsx | 2 +- 6 files changed, 104 insertions(+), 70 deletions(-) diff --git a/app/components/Button.tsx b/app/components/Button.tsx index b17fe20697..54d9a33603 100644 --- a/app/components/Button.tsx +++ b/app/components/Button.tsx @@ -34,6 +34,7 @@ const RealButton = styled(ActionButton)` cursor: var(--pointer); user-select: none; appearance: none !important; + transition: background 200ms ease-out; ${undraggableOnDesktop()} &::-moz-focus-inner { @@ -44,6 +45,7 @@ const RealButton = styled(ActionButton)` &:hover:not(:disabled), &[aria-expanded="true"] { background: ${(props) => darken(0.05, props.theme.accent)}; + transition: background 0s; } &:disabled { @@ -78,6 +80,7 @@ const RealButton = styled(ActionButton)` box-shadow: rgba(0, 0, 0, 0.07) 0px 1px 2px, ${ props.theme.buttonNeutralBorder } 0 0 0 1px inset; + transition: background 0s; } &:focus-visible { @@ -103,6 +106,7 @@ const RealButton = styled(ActionButton)` &:hover:not(:disabled), &[aria-expanded="true"] { background: ${darken(0.05, props.theme.danger)}; + transition: background 0s; } &:disabled { diff --git a/app/components/EditableTitle.tsx b/app/components/EditableTitle.tsx index b00399b44b..9357e57fd4 100644 --- a/app/components/EditableTitle.tsx +++ b/app/components/EditableTitle.tsx @@ -42,27 +42,47 @@ function EditableTitle( setValue(title); }, [title]); - const handleChange = React.useCallback((event) => { - setValue(event.target.value); - }, []); + const handleChange = React.useCallback( + (event: React.ChangeEvent) => { + setValue(event.target.value); + }, + [] + ); - const handleDoubleClick = React.useCallback((event) => { - event.preventDefault(); - event.stopPropagation(); - setIsEditing(true); - }, []); + const handleDoubleClick = React.useCallback( + (event: React.MouseEvent) => { + if (event.altKey) { + return; + } + event.preventDefault(); + event.stopPropagation(); + setIsEditing(true); + }, + [] + ); - const stopPropagation = React.useCallback((event) => { - event.preventDefault(); - event.stopPropagation(); - }, []); + const stopPropagation = React.useCallback( + (event: React.MouseEvent) => { + event.preventDefault(); + event.stopPropagation(); + }, + [] + ); - const handleFocus = React.useCallback((event) => { - event.target.select(); - }, []); + const handleFocus = React.useCallback( + (event: React.FocusEvent) => { + event.target.select(); + }, + [] + ); const handleSave = React.useCallback( - async (ev) => { + async ( + ev: + | React.FocusEvent + | React.KeyboardEvent + | React.FormEvent + ) => { ev.preventDefault(); ev.stopPropagation(); @@ -98,7 +118,7 @@ function EditableTitle( ); const handleKeyDown = React.useCallback( - async (ev) => { + async (ev: React.KeyboardEvent) => { if (ev.nativeEvent.isComposing) { return; } diff --git a/app/components/OAuthClient/OAuthClientForm.tsx b/app/components/OAuthClient/OAuthClientForm.tsx index 4e1f26e2a6..38a461614b 100644 --- a/app/components/OAuthClient/OAuthClientForm.tsx +++ b/app/components/OAuthClient/OAuthClientForm.tsx @@ -10,6 +10,7 @@ import Flex from "~/components/Flex"; import Input, { LabelText } from "~/components/Input"; import isCloudHosted from "~/utils/isCloudHosted"; import Switch from "../Switch"; +import EventBoundary from "@shared/components/EventBoundary"; export interface FormData { name: string; @@ -62,17 +63,19 @@ export const OAuthClientForm = observer(function OAuthClientForm_({ control={control} name="avatarUrl" render={({ field }) => ( - field.onChange(url)} - onError={(err) => setError("avatarUrl", { message: err })} - model={{ - id: oauthClient?.id, - avatarUrl: field.value, - initial: getValues().name[0], - }} - borderRadius={0} - /> + + field.onChange(url)} + onError={(err) => setError("avatarUrl", { message: err })} + model={{ + id: oauthClient?.id, + avatarUrl: field.value, + initial: getValues().name[0], + }} + borderRadius={0} + /> + )} /> diff --git a/app/components/Sidebar/components/Disclosure.tsx b/app/components/Sidebar/components/Disclosure.tsx index e9a42897ae..48c9c66980 100644 --- a/app/components/Sidebar/components/Disclosure.tsx +++ b/app/components/Sidebar/components/Disclosure.tsx @@ -1,24 +1,22 @@ import { CollapsedIcon } from "outline-icons"; import * as React from "react"; import { useTranslation } from "react-i18next"; -import styled, { css } from "styled-components"; -import { s } from "@shared/styles"; +import styled from "styled-components"; +import { extraArea, s } from "@shared/styles"; import NudeButton from "~/components/NudeButton"; type Props = React.ComponentProps & { onClick?: React.MouseEventHandler; expanded: boolean; - root?: boolean; }; -function Disclosure({ onClick, root, expanded, ...rest }: Props) { +function Disclosure({ onClick, expanded, ...rest }: Props) { const { t } = useTranslation(); return (