mirror of
https://github.com/HeyPuter/puter.git
synced 2026-10-16 00:29:27 +00:00
Dashboard Files: hide New Folder and Upload in the Shared view
Shared is a query over other people's items, not a directory. Both buttons stayed visible there: New Folder did nothing, and Upload opened the OS file picker and then silently dropped whatever the user picked. Hide them the same way Trash already does.
This commit is contained in:
1 parent
09552201ff
commit
65ae8c6eae
1 file changed
+5
-3
@@ -1822,16 +1822,19 @@ const TabFiles = {
|
||||
* Updates header action buttons based on current folder context.
|
||||
*
|
||||
* Shows/hides new folder, upload, and empty trash buttons as appropriate.
|
||||
* Neither Trash nor the Shared view (a query, not a directory) can have
|
||||
* anything created or uploaded into it, so those two buttons stay out
|
||||
* there rather than opening a picker whose files would be dropped.
|
||||
*
|
||||
* @param {boolean} isTrashFolder - Whether the current folder is the Trash
|
||||
* @returns {void}
|
||||
*/
|
||||
updateActionButtons (isTrashFolder) {
|
||||
const $pathActions = this.$el_window.find('.path-actions');
|
||||
const canCreate = ! isTrashFolder && this.currentPath !== window.shared_path;
|
||||
$pathActions.find('.new-folder-btn, .upload-btn').toggle(canCreate);
|
||||
|
||||
if ( isTrashFolder ) {
|
||||
$pathActions.find('.new-folder-btn, .upload-btn').hide();
|
||||
|
||||
if ( $pathActions.find('.empty-trash-btn').length === 0 ) {
|
||||
const emptyTrashBtn = $(`<button class="path-action-btn empty-trash-btn" title="${i18n('empty_trash')}">${icons.trash}</button>`);
|
||||
$pathActions.append(emptyTrashBtn);
|
||||
@@ -1841,7 +1844,6 @@ const TabFiles = {
|
||||
}
|
||||
$pathActions.find('.empty-trash-btn').show();
|
||||
} else {
|
||||
$pathActions.find('.new-folder-btn, .upload-btn').show();
|
||||
$pathActions.find('.empty-trash-btn').hide();
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user