Skip to content

Commit

Permalink
Remove unnecessary code and try event handling instead
Browse files Browse the repository at this point in the history
Add JavaScript Key Event Handling: Capture the Enter key press within the title input field to insert a newline character.
  • Loading branch information
randemgame committed Nov 16, 2024
1 parent 223babb commit b4f9c5e
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 70 deletions.
11 changes: 1 addition & 10 deletions ui/v2.5/src/components/Scenes/SceneDetails/Scene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import { useRatingKeybinds } from "src/hooks/keybinds";
import { lazyComponent } from "src/utils/lazyComponent";
import cx from "classnames";
import { TruncatedText } from "src/components/Shared/TruncatedText";
import { TitleDisplay } from "src/components/Shared/TitleDisplay";

const SubmitStashBoxDraft = lazyComponent(
() => import("src/components/Dialogs/SubmitDraft")
Expand Down Expand Up @@ -585,15 +584,7 @@ const ScenePage: React.FC<IProps> = ({
</h1>
)}
<h3 className={cx("scene-header", { "no-studio": !scene.studio })}>
<TruncatedText
lineCount={2}
text={
<TitleDisplay
text={String(title)}
className="title-display"
/>
}
/>
<TruncatedText lineCount={2} text={title} />
</h3>
</div>

Expand Down
Empty file.
16 changes: 6 additions & 10 deletions ui/v2.5/src/components/Scenes/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
padding: 0.5rem 1rem 0 1rem;
}

input[type="text"] {
white-space: pre-wrap;
height: auto;
overflow-y: hidden;
}

.performer-tag-container,
.group-tag-container {
display: inline-block;
Expand Down Expand Up @@ -899,13 +905,3 @@ input[type="range"].blue-slider {
word-break: break-all;
}
}

.title-display {
width: 100%;

br {
content: "";
display: block;
margin: 2px 0;
}
}
12 changes: 1 addition & 11 deletions ui/v2.5/src/components/Shared/GridCard/GridCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import useResizeObserver from "@react-hook/resize-observer";
import { Icon } from "../Icon";
import { faGripLines } from "@fortawesome/free-solid-svg-icons";
import { DragSide, useDragMoveSelect } from "./dragMoveSelect";
import { TitleDisplay } from "src/components/Shared/TitleDisplay";

interface ICardProps {
className?: string;
Expand Down Expand Up @@ -229,16 +228,7 @@ export const GridCard: React.FC<ICardProps> = (props: ICardProps) => {
<Link to={props.url} onClick={handleImageClick}>
<h5 className="card-section-title flex-aligned">
{props.pretitleIcon}
<TruncatedText
text={
typeof props.title === "string" ? (
<TitleDisplay text={props.title} className="title-display" />
) : (
props.title
)
}
lineCount={2}
/>
<TruncatedText text={props.title} lineCount={2} />
</h5>
</Link>
{props.details}
Expand Down
10 changes: 0 additions & 10 deletions ui/v2.5/src/components/Shared/GridCard/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,3 @@
.card-drag-handle {
filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.7));
}

.title-display {
width: 100%;

br {
content: "";
display: block;
margin: 2px 0;
}
}
24 changes: 0 additions & 24 deletions ui/v2.5/src/components/Shared/TitleDisplay.tsx

This file was deleted.

6 changes: 1 addition & 5 deletions ui/v2.5/src/utils/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,7 @@ export function formikUtils<V extends FormikValues>(
props?: IProps
) {
const title = intl.formatMessage({ id: messageID });
const control = renderFormControl(
field,
field === "title" ? "textarea" : type,
title
);
const control = renderFormControl(field, type, title);

return renderField(field, title, control, props);
}
Expand Down

0 comments on commit b4f9c5e

Please sign in to comment.