Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directly use fsinfo state #434

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jelly
Copy link
Member

@jelly jelly commented May 7, 2024

Some research upfront would be nice:

  • selected state is in App which means every selection re-renders all children, is there a better way?
  • Sorting memozises the state, so any fsinfo update re-renders

@allisonkarlitskaya allisonkarlitskaya self-requested a review May 7, 2024 12:30
@jelly jelly changed the title Try out Directly use fsinfo state May 7, 2024
src/files-folder-view.tsx Fixed Show fixed Hide fixed
modalTitle = cockpit.format(
forceDelete ? _("Force delete link $0?") : _("Delete link $0?"), selectedItem.name
forceDelete ? _("Force delete link $0?") : _("Delete link $0?"), selected[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test.

modalTitle = cockpit.format(
forceDelete ? _("Force delete directory $0?") : _("Delete directory $0?"), selectedItem.name
forceDelete ? _("Force delete directory $0?") : _("Delete directory $0?"), selected[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test.

);
} else {
modalTitle = cockpit.format(forceDelete ? _("Force delete $0") : _("Delete $0?"), selectedItem.name);
modalTitle = cockpit.format(forceDelete ? _("Force delete $0") : _("Delete $0?"), selected[0]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test.

Comment on lines +200 to +202
} else if (fileInfo?.type === "lnk") {
title = cockpit.format(_("Rename link $0"), selected);
} else if (fileInfo?.type === "dir") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 3 added lines are not executed by any test.

} else {
title = _("Rename $0", selected.name);
title = _("Rename $0", selected);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test.

menuItems.push(
{
id: "copy-item",
title: _("Copy"),
onClick: () => setClipboard([currentPath + selected[0].name]),
onClick: () => setClipboard([currentPath + selected[0]]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test.

? [
{
id: "paste-into-directory",
title: _("Paste into directory"),
onClick: () => spawnPaste(clipboard, [currentPath + selected[0].name]),
onClick: () => spawnPaste(clipboard, [currentPath + selected[0]]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test.

@@ -549,7 +562,7 @@ export const fileActions = (path, selected, setSelected, clipboard, setClipboard
{
id: "copy-item",
title: _("Copy"),
onClick: () => setClipboard(selected.map(s => path.join("/") + "/" + s.name)),
onClick: () => setClipboard(selected.map(s => path.join("/") + "/" + s)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test.

const onDoubleClickNavigate = useCallback((filename) => {
const newPath = [...path, filename].join("/");
const file = files[filename];
if (files && (file.type === "dir" || file.to === "dir")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test.

function getFileType(file) {
if (file.type === "dir") {
return "directory-item";
} else if (file.type === "lnk" && file?.to === "dir") {
// TODO: info.target(name)?.type
} else if (file.type === "lnk" && cwdInfo?.targets[filename]?.type === "dir") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants