Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions frontend/app/view/preview/directorypreview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,10 @@
border: 1px solid rgba(255, 255, 255, 0.15);
background: #212121;
box-shadow: 0px 8px 24px 0px rgba(0, 0, 0, 0.3);

.entry-manager-buttons {
display: flex;
flex-direction: row;
gap: 10px;
}
}
24 changes: 22 additions & 2 deletions frontend/app/view/preview/directorypreview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0

import { Button } from "@/app/element/button";
import { Input } from "@/app/element/input";
import { ContextMenuModel } from "@/app/store/contextmenu";
import { PLATFORM, atoms, createBlock, getApi, globalStore } from "@/app/store/global";
Expand Down Expand Up @@ -146,12 +147,21 @@ type EntryManagerOverlayProps = {
entryManagerType: EntryManagerType;
startingValue?: string;
onSave: (newValue: string) => void;
onCancel?: () => void;
style?: React.CSSProperties;
getReferenceProps?: () => any;
};

const EntryManagerOverlay = memo(
({ entryManagerType, startingValue, onSave, forwardRef, style, getReferenceProps }: EntryManagerOverlayProps) => {
({
entryManagerType,
startingValue,
onSave,
onCancel,
forwardRef,
style,
getReferenceProps,
}: EntryManagerOverlayProps) => {
const [value, setValue] = useState(startingValue);
return (
<div className="entry-manager-overlay" ref={forwardRef} style={style} {...getReferenceProps()}>
Expand All @@ -168,7 +178,15 @@ const EntryManagerOverlay = memo(
onSave(value);
}
}}
></Input>
/>
</div>
<div className="entry-manager-buttons">
<Button className="vertical-padding-4" onClick={() => onSave(value)}>
Save
</Button>
<Button className="vertical-padding-4 red outlined" onClick={onCancel}>
Cancel
</Button>
</div>
</div>
);
Expand Down Expand Up @@ -870,6 +888,7 @@ function DirectoryPreview({ model }: DirectoryPreviewProps) {
}}
{...getReferenceProps()}
onContextMenu={(e) => handleFileContextMenu(e)}
onClick={() => setEntryManagerProps(undefined)}
>
<DirectoryTable
model={model}
Expand All @@ -891,6 +910,7 @@ function DirectoryPreview({ model }: DirectoryPreviewProps) {
forwardRef={refs.setFloating}
style={floatingStyles}
getReferenceProps={getFloatingProps}
onCancel={() => setEntryManagerProps(undefined)}
/>
)}
</Fragment>
Expand Down