2024-07-21 17:55:53 +02:00
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
2026-04-08 21:03:36 +00:00
|
|
|
import { PATH_COMPONENT_SEPARATOR } from "../../Model/Global/storageModel";
|
2024-07-22 19:52:08 +02:00
|
|
|
import StorageViewModel from "../../ViewModel/Global/storageViewModel";
|
2024-07-21 17:55:53 +02:00
|
|
|
import { translations } from "../translations";
|
|
|
|
|
|
2026-04-08 21:03:36 +00:00
|
|
|
import { SplitModal } from "../Components/splitModal";
|
|
|
|
|
import { DangerousActionButton } from "../Components/dangerousActionButton";
|
|
|
|
|
import { DirectoryItemList } from "../Components/directoryItemList";
|
|
|
|
|
|
2024-07-21 17:55:53 +02:00
|
|
|
export function StorageModal(storageViewModel: StorageViewModel) {
|
2026-04-08 21:03:36 +00:00
|
|
|
const detailView = React.createProxyState(
|
|
|
|
|
[storageViewModel.selectedPath],
|
|
|
|
|
() => {
|
|
|
|
|
if (storageViewModel.selectedPath.value == PATH_COMPONENT_SEPARATOR)
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<span class="secondary">
|
|
|
|
|
{translations.storage.noItemSelected}
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<hr></hr>
|
|
|
|
|
|
|
|
|
|
{DangerousActionButton(
|
|
|
|
|
translations.storage.removeJunkButton,
|
|
|
|
|
"delete_forever",
|
|
|
|
|
storageViewModel.removeJunk,
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div class="flex-column gap">
|
|
|
|
|
<div class="tile flex-no">
|
|
|
|
|
<div>
|
|
|
|
|
<b>{translations.storage.path}</b>
|
|
|
|
|
<span
|
|
|
|
|
class="break-all"
|
|
|
|
|
subscribe:innerText={
|
|
|
|
|
storageViewModel.selectedPath
|
|
|
|
|
}
|
|
|
|
|
></span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tile flex-no">
|
|
|
|
|
<div>
|
|
|
|
|
<b>{translations.storage.content}</b>
|
|
|
|
|
<code
|
|
|
|
|
subscribe:innerText={
|
|
|
|
|
storageViewModel.selectedFileContent
|
|
|
|
|
}
|
|
|
|
|
></code>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{DangerousActionButton(
|
|
|
|
|
translations.storage.deleteItem,
|
|
|
|
|
"delete_forever",
|
|
|
|
|
storageViewModel.deleteSelectedItem,
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-01 08:29:39 +00:00
|
|
|
return (
|
|
|
|
|
<div class="modal" toggle:open={storageViewModel.isShowingStorageModal}>
|
|
|
|
|
<div style="max-width: 64rem">
|
2026-04-08 21:03:36 +00:00
|
|
|
<main class="padding-0">
|
|
|
|
|
{SplitModal(
|
|
|
|
|
new React.State(DirectoryItemList(storageViewModel)),
|
|
|
|
|
detailView,
|
|
|
|
|
storageViewModel.selectedFileName,
|
|
|
|
|
)}
|
|
|
|
|
</main>
|
2026-04-01 08:29:39 +00:00
|
|
|
<button on:click={storageViewModel.hideStorageModal}>
|
|
|
|
|
{translations.general.closeButton}
|
|
|
|
|
<span class="icon">close</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2024-07-21 17:55:53 +02:00
|
|
|
}
|