Skip to content

Commit

Permalink
fix(cypress): formatFileSize change revert from files library
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Nov 7, 2023
1 parent b62515f commit d5371bd
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 42 deletions.
36 changes: 17 additions & 19 deletions apps/files/src/components/FileEntry/FileEntryActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,23 @@
:open.sync="openedMenu"
@close="openedSubmenu = null">
<!-- Default actions list-->
<template>
<NcActionButton v-for="action in enabledMenuActions"
:key="action.id"
:class="{
[`files-list__row-action-${action.id}`]: true,
[`files-list__row-action--menu`]: isMenu(action.id)
}"
:close-after-click="!isMenu(action.id)"
:data-cy-files-list-row-action="action.id"
:is-menu="isMenu(action.id)"
:title="action.title?.([source], currentView)"
@click="onActionClick(action)">
<template #icon>
<NcLoadingIcon v-if="loading === action.id" :size="18" />
<NcIconSvgWrapper v-else :svg="action.iconSvgInline([source], currentView)" />
</template>
{{ actionDisplayName(action) }}
</NcActionButton>
</template>
<NcActionButton v-for="action in enabledMenuActions"
:key="action.id"
:class="{
[`files-list__row-action-${action.id}`]: true,
[`files-list__row-action--menu`]: isMenu(action.id)
}"
:close-after-click="!isMenu(action.id)"
:data-cy-files-list-row-action="action.id"
:is-menu="isMenu(action.id)"
:title="action.title?.([source], currentView)"
@click="onActionClick(action)">
<template #icon>
<NcLoadingIcon v-if="loading === action.id" :size="18" />
<NcIconSvgWrapper v-else :svg="action.iconSvgInline([source], currentView)" />
</template>
{{ actionDisplayName(action) }}
</NcActionButton>
<!-- Submenu actions list-->
<template v-if="openedSubmenu && enabledSubmenuActions[openedSubmenu?.id]">
Expand Down
4 changes: 2 additions & 2 deletions apps/files/src/components/NavigationQuota.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export default {
computed: {
storageStatsTitle() {
const usedQuotaByte = formatFileSize(this.storageStats?.used, false, false)
const quotaByte = formatFileSize(this.storageStats?.quota, false, false)
const usedQuotaByte = formatFileSize(this.storageStats?.used, false, false, true)
const quotaByte = formatFileSize(this.storageStats?.quota, false, false, true)
// If no quota set
if (this.storageStats?.quota < 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
*/
// TODO: remove when/if the actions API supports a separator
// This the last preset action, so we need to add a separator
.files-list__row-action-set-reminder-3 {
margin-bottom: 13px;
.files-list__row-action-set-reminder-custom {
margin-top: 13px;
position: relative;

&::after {
&::before {
content: "";
margin: 3px 10px 3px 15px;
border-bottom: 1px solid var(--color-border-dark);
Expand All @@ -34,5 +35,6 @@
position: absolute;
left: 0;
right: 0;
top: -10px;
}
}
18 changes: 14 additions & 4 deletions apps/files_reminders/src/actions/setReminderSuggestionActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,21 @@ const nextWeek: ReminderOption = {
ariaLabel: t('files_reminders', 'Set reminder for next week'),
}

// Generate the default preset actions
export const actions = [laterToday, tomorrow, thisWeekend, nextWeek].map((option): FileAction|null => {
/**
* Generate a file action for the given option
*
* @param option The option to generate the action for
* @return The file action or null if the option should not be shown
*/
const generateFileAction = (option): FileAction|null => {
const dateTime = getDateTime(option.dateTimePreset)
if (!dateTime) {
return null
}

return new FileAction({
id: `set-reminder-${option.dateTimePreset}`,
displayName: () => `${option.label} - ${getDateString(dateTime)}`,
displayName: () => `${option.label} ${getDateString(dateTime)}`,
title: () => `${option.ariaLabel}${getVerboseDateString(dateTime)}`,

// Empty svg to hide the icon
Expand Down Expand Up @@ -103,4 +108,9 @@ export const actions = [laterToday, tomorrow, thisWeekend, nextWeek].map((option

order: 21,
})
}).filter(Boolean) as FileAction[]
}

// Generate the default preset actions
export const actions = [laterToday, tomorrow, thisWeekend, nextWeek]
.map(generateFileAction)
.filter(Boolean) as FileAction[]
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ export default Vue.extend({
},
async setCustom(): Promise<void> {
// Handle input cleared
if (this.customDueDate === '') {
// Handle input cleared or invalid date
if (!(this.customDueDate instanceof Date) || isNaN(this.customDueDate)) {
showError(t('files_reminders', 'Please choose a valid date & time'))
return
}
Expand Down
2 changes: 0 additions & 2 deletions apps/files_reminders/src/services/customPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ const CustomReminderModal = new View({
})

export const pickCustomDate = async (node: Node): Promise<void> => {
console.debug('CustomReminderModal', mount, CustomReminderModal)

CustomReminderModal.open(node)

// Wait for the modal to close
Expand Down
8 changes: 4 additions & 4 deletions apps/files_reminders/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import moment from '@nextcloud/moment'
import { getCanonicalLocale } from '@nextcloud/l10n'

export enum DateTimePreset {
LaterToday,
Tomorrow,
ThisWeekend,
NextWeek,
LaterToday = 'later-today',
Tomorrow = 'tomorrow',
ThisWeekend = 'this-weekend',
NextWeek = 'next-week',
}

export const getDateTime = (dateTime: DateTimePreset): null | Date => {
Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_reminders-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_reminders-init.js.map

Large diffs are not rendered by default.

0 comments on commit d5371bd

Please sign in to comment.