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

Studio usability enhancements #4461

Merged
merged 133 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
1319e1f
Add edit title and description modal
AlexVelezLl Dec 8, 2023
780174c
Refactor and maxlength
AlexVelezLl Dec 8, 2023
d34108e
Show snackbar on edit
AlexVelezLl Dec 8, 2023
82ce6bc
Linting files
AlexVelezLl Dec 8, 2023
dfb8c44
Add tests to EditTitleDescriptionModal component
AlexVelezLl Dec 11, 2023
d2a7c31
Restore package.json
AlexVelezLl Dec 11, 2023
87ad48f
Refactor modal validations
AlexVelezLl Dec 14, 2023
ecf3816
Delegate modal render to CurrentTopicVue component
AlexVelezLl Dec 14, 2023
620939f
Update component interface in tests
AlexVelezLl Dec 14, 2023
f0c0cbf
Removing unused nodes
AlexVelezLl Dec 14, 2023
25a2721
Fix tests
AlexVelezLl Dec 14, 2023
27f437d
Merge pull request #4354 from AlexVelezLl/quick-edit-modal-title-desc…
AlexVelezLl Dec 15, 2023
637d5e6
Add new kebab menu items, and refactor structure for quick edit modals
AlexVelezLl Dec 19, 2023
cf52c85
Lint files
AlexVelezLl Dec 19, 2023
752e572
Refactor content node options
AlexVelezLl Jan 2, 2024
d7abcd4
Merge pull request #4368 from AlexVelezLl/kebab-menu
AlexVelezLl Jan 2, 2024
f6f45ab
Add editLanguage quick editmodal
AlexVelezLl Jan 2, 2024
c2ea655
Linting
AlexVelezLl Jan 2, 2024
b882b28
Update descendants in vuex state
AlexVelezLl Dec 21, 2023
6735bb0
Update descendants in inexedDB
AlexVelezLl Dec 21, 2023
f0f5409
Update descendants support on backend
AlexVelezLl Dec 27, 2023
f3e0c3d
Apply returned changes
AlexVelezLl Dec 27, 2023
e1d8be7
Check for descendants updates on ContentNode set data
AlexVelezLl Dec 27, 2023
382ea98
Refactor and linting
AlexVelezLl Dec 27, 2023
12d6f4d
Add frontend tests
AlexVelezLl Dec 27, 2023
c807d6b
Tests for resources
AlexVelezLl Dec 28, 2023
d577a06
Linting files
AlexVelezLl Dec 28, 2023
bf6dfd6
Update resources language
AlexVelezLl Jan 4, 2024
ccc58a7
Add information messages for topics
AlexVelezLl Jan 5, 2024
6225491
Adding tests and linting files
AlexVelezLl Jan 5, 2024
fe468fa
Remove setTimeout and chaining operator
AlexVelezLl Jan 10, 2024
0744636
Merge pull request #4355 from AlexVelezLl/quick-edit-modal-language
AlexVelezLl Jan 10, 2024
eca5ec7
Add backend tests
AlexVelezLl Jan 11, 2024
ba6c2eb
Add functions documentations
AlexVelezLl Jan 11, 2024
1bd4755
Merge pull request #4372 from AlexVelezLl/update-descentants-changes
AlexVelezLl Jan 11, 2024
d32b488
Update method to updateDescendants in editLanguageModal
AlexVelezLl Jan 11, 2024
e016462
Set mod deleted properties
AlexVelezLl Jan 11, 2024
2867795
Cleaning boolean maps
AlexVelezLl Jan 12, 2024
d9e801e
Add Edit resources needed modal
AlexVelezLl Jan 11, 2024
090fd26
Add bulk selection support
AlexVelezLl Jan 11, 2024
cfe97be
Add unit tests
AlexVelezLl Jan 11, 2024
60916ba
Update method to updateDescendants in editResourcesNeededModal
AlexVelezLl Jan 11, 2024
7068b47
Lint files
AlexVelezLl Jan 12, 2024
7c0d0d1
Merge pull request #4394 from AlexVelezLl/quick-edit-modal-wywneed
AlexVelezLl Jan 12, 2024
193f26c
Making contentNodeMenu accessible
AlexVelezLl Jan 17, 2024
477f558
Replicate conditional menu render to other parts of studio
AlexVelezLl Jan 17, 2024
a197235
Lint files
AlexVelezLl Jan 17, 2024
f0bda8f
Merge pull request #4402 from AlexVelezLl/menu-accessible
AlexVelezLl Jan 18, 2024
acfddfa
Add categories checkboxes
AlexVelezLl Jan 5, 2024
427ac2a
Load nodes initial categories
AlexVelezLl Jan 7, 2024
1ed6ad5
Update content nodes categories
AlexVelezLl Jan 8, 2024
539feb5
Add unit tests
AlexVelezLl Jan 11, 2024
6fdbf37
Add empty search text
AlexVelezLl Jan 11, 2024
7244044
Remove unused code and add comments
AlexVelezLl Jan 11, 2024
935cf1e
Fix identifiers
AlexVelezLl Jan 11, 2024
cc97295
Update method to updateDescendants in editCategoryModal
AlexVelezLl Jan 11, 2024
0fde92b
Lint files
AlexVelezLl Jan 11, 2024
6c6bd04
Fix display categories
AlexVelezLl Jan 11, 2024
e9613f9
Add editBooleanMapModal
AlexVelezLl Jan 12, 2024
8082687
Refactor EditCategoriesModal
AlexVelezLl Jan 12, 2024
02a96c4
Refactor Resources Needed Modal
AlexVelezLl Jan 12, 2024
844f416
Add edit levels modal
AlexVelezLl Jan 12, 2024
54a743a
Add comments
AlexVelezLl Jan 12, 2024
3fe8cd9
Lint files
AlexVelezLl Jan 12, 2024
137e61b
Add learning activities modal
AlexVelezLl Jan 12, 2024
ee6238b
Refactor isSelected method
AlexVelezLl Jan 24, 2024
940af3f
Merge pull request #4386 from AlexVelezLl/quick-edit-modal-categories
AlexVelezLl Jan 24, 2024
e2bdbd7
Merge unstable into studio-usability-enhancements
AlexVelezLl Jan 25, 2024
9890ae2
Merge branch 'unstable' into studio-usability-enhancements
AlexVelezLl Feb 14, 2024
6d6a321
Update kds version
AlexVelezLl Feb 14, 2024
5007687
Add quick edit modal to edit audience
AlexVelezLl Jan 18, 2024
529faf6
Add isTopic condition
AlexVelezLl Jan 18, 2024
9dd3fab
Lint files
AlexVelezLl Jan 18, 2024
19e1080
Bulk edit audience
AlexVelezLl Jan 29, 2024
5a3d8a0
Add unit tests
AlexVelezLl Jan 29, 2024
8fa5c20
Lint files
AlexVelezLl Jan 29, 2024
50b7740
Refactor isMultipleAudience computed property
AlexVelezLl Feb 14, 2024
fa6580c
Merge pull request #4405 from AlexVelezLl/quick-edit-modal-audience
AlexVelezLl Feb 14, 2024
8bf77b7
Add About Licenses modal
AlexVelezLl Jan 30, 2024
d25db5f
Add EditSourceModal structure
AlexVelezLl Jan 30, 2024
1b0a40d
Add loading data logic
AlexVelezLl Jan 30, 2024
9c09a44
Add Mixed Value
AlexVelezLl Jan 31, 2024
dfc69de
Restrict isDisableSourceEdits
AlexVelezLl Feb 1, 2024
fdd0062
Add tests
AlexVelezLl Feb 1, 2024
1e5df46
Add unit tests
AlexVelezLl Feb 5, 2024
159669a
Add validation
AlexVelezLl Feb 14, 2024
823d16b
Merge pull request #4424 from AlexVelezLl/quick-edit-modal-attribution
AlexVelezLl Feb 15, 2024
e3d9405
Merge branch 'unstable' into studio-usability-enhancements
AlexVelezLl Feb 16, 2024
e92ff63
Replace studio usability icons
AlexVelezLl Feb 14, 2024
fb4e5da
Target kds dep to specific commit
AlexVelezLl Feb 14, 2024
f1688e2
Add source and attribution icons
AlexVelezLl Feb 16, 2024
0a84a89
Merge pull request #4442 from AlexVelezLl/replace-new-icons
AlexVelezLl Feb 16, 2024
0483db2
Fix styles
AlexVelezLl Feb 27, 2024
ccad558
New command palette arrangement, and responsive design
AlexVelezLl Feb 22, 2024
ad5ce70
Update KListWithOverflow
AlexVelezLl Feb 27, 2024
9c80359
Options conditional rendering
AlexVelezLl Feb 27, 2024
cb16a17
Install new KDS commit
AlexVelezLl Feb 29, 2024
f1924c2
Self code review
AlexVelezLl Feb 29, 2024
c7966a6
Merge pull request #4446 from AlexVelezLl/update-command-palette
AlexVelezLl Feb 29, 2024
8d0729a
Merge unstable into studio-usability-enhancements
AlexVelezLl Feb 29, 2024
f4495b2
Edit contentnodeoptions conditions
AlexVelezLl Feb 29, 2024
aca6ba2
Add base components
AlexVelezLl Jan 18, 2024
d6e919c
Completion modal
AlexVelezLl Mar 1, 2024
3cb74c5
Code review
AlexVelezLl Mar 8, 2024
a2d3f84
Add validations
AlexVelezLl Mar 8, 2024
df69a0d
Lint files
AlexVelezLl Mar 8, 2024
473c8ba
Merge unstable into studio-usability-enhancements
AlexVelezLl Mar 8, 2024
1141054
requested changes
AlexVelezLl Mar 8, 2024
809180d
Fix isMultipleNodeLanguages
AlexVelezLl Mar 14, 2024
1858ff1
Fix tests
AlexVelezLl Mar 14, 2024
b95db68
Merge branch 'unstable' into studio-usability-enhancements
AlexVelezLl Mar 14, 2024
7aea4e1
Lint files
AlexVelezLl Mar 14, 2024
927793a
Add multi support for expandable select
AlexVelezLl Mar 1, 2024
794941d
Add shared Category Options
AlexVelezLl Mar 1, 2024
9130015
Add categories options support
AlexVelezLl Mar 1, 2024
767b2c6
Add learning activities options
AlexVelezLl Mar 4, 2024
7c26aa0
Add ResourcesNeeded Options
AlexVelezLl Mar 4, 2024
6d4d498
fix tests
AlexVelezLl Mar 4, 2024
7943411
Add comments
AlexVelezLl Mar 6, 2024
6d1577b
Removing options components as prop
AlexVelezLl Mar 12, 2024
6db61a0
Simplifying boolean maps values
AlexVelezLl Mar 14, 2024
5b199ff
Fix tests
AlexVelezLl Mar 14, 2024
feded9c
Lint files
AlexVelezLl Mar 14, 2024
7547683
Requested changes
AlexVelezLl Mar 15, 2024
e2fe971
Merge pull request #4464 from AlexVelezLl/fix-two-parallel-impl
bjester Mar 15, 2024
50339ef
Requested changes
AlexVelezLl Mar 20, 2024
0a6342c
Refactoring set quick edit modal mutations
AlexVelezLl Mar 25, 2024
324e3a2
Update activityDuration validators
AlexVelezLl May 24, 2024
c6eafef
Merge unstable into develop
AlexVelezLl Jun 27, 2024
3f31bc8
Update yarn.lock
AlexVelezLl Jun 27, 2024
6dfee0b
Merge unstable into studio-usability-enhancements
AlexVelezLl Aug 13, 2024
da66153
Styles fixes
AlexVelezLl Aug 13, 2024
4dcc60d
Fix tests
AlexVelezLl Aug 13, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<Menu v-model="value" :position-x="positionX" :position-y="positionY" absolute>
<VCard>
<slot>
<slot v-if="value">
<ContentNodeOptions :nodeId="nodeId" :hideDetailsLink="hideDetailsLink" />
</slot>
</VCard>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
</template>

<template #actions-end>
<VListTileAction class="action-icon px-1" @click.stop>
<transition name="fade">
<IconButton
icon="rename"
size="small"
:text="$tr('editTooltip')"
:disabled="copying"
@click.stop
@click="editTitleDescription()"
/>
</transition>
</VListTileAction>
<VListTileAction :aria-hidden="!active" class="action-icon px-1">
<Menu v-model="activated">
<template #activator="{ on }">
Expand All @@ -57,7 +69,7 @@
@click.stop
/>
</template>
<ContentNodeOptions v-if="!copying" :nodeId="nodeId" />
<ContentNodeOptions v-if="!copying && activated" :nodeId="nodeId" />
</Menu>
</VListTileAction>
</template>
Expand Down Expand Up @@ -105,7 +117,7 @@
import DraggableItem from 'shared/views/draggable/DraggableItem';
import { ContentNode } from 'shared/data/resources';
import { DragEffect, DropEffect, EffectAllowed } from 'shared/mixins/draggable/constants';
import { DraggableRegions } from 'frontend/channelEdit/constants';
import { QuickEditModals, DraggableRegions } from 'frontend/channelEdit/constants';
import { withChangeTracker } from 'shared/data/changes';
import { COPYING_STATUS, COPYING_STATUS_VALUES } from 'shared/data/constants';

Expand Down Expand Up @@ -235,7 +247,14 @@
'updateContentNode',
'waitForCopyingStatus',
'deleteContentNode',
'setQuickEditModal',
]),
editTitleDescription() {
this.setQuickEditModal({
modal: QuickEditModals.TITLE_DESCRIPTION,
nodeIds: [this.nodeId],
});
},
retryFailedCopy: withChangeTracker(function(changeTracker) {
this.updateContentNode({
id: this.nodeId,
Expand Down Expand Up @@ -280,6 +299,7 @@
creatingCopies: 'Copying...',
copiedSnackbar: 'Copy operation complete',
undo: 'Undo',
editTooltip: 'Edit Title & Description',
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,50 @@
<template>

<VList>
<VListTile v-if="isTopic && canEdit" @click="newTopicNode">
<VListTileTitle>{{ $tr('newSubtopic') }}</VListTileTitle>
</VListTile>
<VListTile v-if="canEdit && !hideEditLink" :to="editLink" @click="trackAction('Edit')">
<VListTileTitle>
{{ isTopic ? $tr('editTopicDetails') : $tr('editDetails') }}
</VListTileTitle>
</VListTile>
<VListTile v-if="!hideDetailsLink" :to="viewLink" @click="trackAction('View')">
<VListTileTitle>{{ $tr('viewDetails') }}</VListTileTitle>
</VListTile>
<VListTile v-if="canEdit" @click.stop="moveModalOpen = true">
<VListTileTitle>{{ $tr('move') }}</VListTileTitle>
<MoveModal
v-if="moveModalOpen"
ref="moveModal"
v-model="moveModalOpen"
:moveNodeIds="[nodeId]"
@target="moveNode"
/>
</VListTile>
<VListTile v-if="canEdit" @click="duplicateNode()">
<VListTileTitle>{{ $tr('makeACopy') }}</VListTileTitle>
</VListTile>
<VListTile @click="copyToClipboard()">
<VListTileTitle>{{ $tr('copyToClipboard') }}</VListTileTitle>
</VListTile>
<VListTile v-if="canEdit" @click="removeNode()">
<VListTileTitle>{{ $tr('remove') }}</VListTileTitle>
</VListTile>
</VList>
<div
style="max-height: 80vh"
AlexVelezLl marked this conversation as resolved.
Show resolved Hide resolved
>
<VList ref="optionsList">
<template
v-for="(group, groupIndex) in groupedOptions"
>
<VListTile
v-for="(option, index) in group"
:key="groupIndex + '-' + index"
class="options-list-item"
ripple
:to="option.to"
tabindex="0"
bjester marked this conversation as resolved.
Show resolved Hide resolved
@click="option.onClick($event)"
@keydown.enter="option.onClick($event)"
@keydown.tab="checkTabBoundaries($event)"
>
<VListTileTitle>
{{ option.label }}
</VListTileTitle>
</VListTile>
<VDivider
v-if="groupIndex < groupedOptions.length - 1"
:key="groupIndex + '-divider'"
class="divider"
/>
</template>
</VList>

<MoveModal
v-if="moveModalOpen"
ref="moveModal"
v-model="moveModalOpen"
:moveNodeIds="[nodeId]"
@target="moveNode"
/>
</div>

</template>

<script>

import { mapActions, mapGetters } from 'vuex';
import { RouteNames, TabNames } from '../constants';
import { RouteNames, TabNames, QuickEditModals } from '../constants';
import MoveModal from './move/MoveModal';
import { withChangeTracker } from 'shared/data/changes';
import { RELATIVE_TREE_POSITIONS } from 'shared/data/constants';
Expand Down Expand Up @@ -76,6 +82,121 @@
isTopic() {
return this.node.kind === 'topic';
},
/**
* Returns a list of options to display in the menu
* @returns {Array<Array<Object>>} List of lists, where each inner list is a group of options
* already filtered by the render condition
*/
groupedOptions() {
const options = [
[
{
label: this.$tr('viewDetails'),
to: this.viewLink,
onClick: () => this.trackAction('View'),
condition: !this.hideDetailsLink,
},
{
label: this.$tr('editTitleDescription'),
onClick: this.quickEditModalFactory(QuickEditModals.TITLE_DESCRIPTION),
condition: this.canEdit,
},
],
[
{
label: this.$tr('editAllDetails'),
to: this.editLink,
onClick: () => this.trackAction('Edit'),
condition: this.canEdit && !this.hideEditLink,
},
{
label: this.$tr('move'),
onClick: $event => {
$event.stopPropagation();
this.moveModalOpen = true;
},
condition: this.canEdit,
},
{
label: this.$tr('copyToClipboard'),
onClick: this.copyToClipboard,
condition: true,
},
{
label: this.$tr('makeACopy'),
onClick: this.duplicateNode,
condition: this.canEdit,
},
{
label: this.$tr('newSubtopic'),
onClick: this.newTopicNode,
condition: this.canEdit && this.isTopic,
},
{
label: this.$tr('remove'),
onClick: this.removeNode,
condition: this.canEdit,
},
],
[
{
label: this.$tr('editTags'),
onClick: this.quickEditModalFactory(QuickEditModals.TAGS),
condition: this.canEdit && false,
},
{
label: this.$tr('editLanguage'),
onClick: this.quickEditModalFactory(QuickEditModals.LANGUAGE),
condition: this.canEdit,
},
],
[
{
label: this.$tr('editCategories'),
onClick: this.quickEditModalFactory(QuickEditModals.CATEGORIES),
condition: this.canEdit,
},
{
label: this.$tr('editLevels'),
onClick: this.quickEditModalFactory(QuickEditModals.LEVELS),
condition: this.canEdit,
},
{
label: this.$tr('editLearningActivities'),
onClick: this.quickEditModalFactory(QuickEditModals.LEARNING_ACTIVITIES),
condition: this.canEdit && !this.isTopic,
},
],
[
{
label: this.$tr('editSource'),
onClick: this.quickEditModalFactory(QuickEditModals.SOURCE),
condition: this.canEdit && !this.isTopic,
},
{
label: this.$tr('editAudience'),
onClick: this.quickEditModalFactory(QuickEditModals.AUDIENCE),
condition: this.canEdit && !this.isTopic,
},
],
[
{
label: this.$tr('editCompletion'),
onClick: this.quickEditModalFactory(QuickEditModals.COMPLETION),
condition: this.canEdit && !this.isTopic,
},
{
label: this.$tr('editWhatIsNeeded'),
onClick: this.quickEditModalFactory(QuickEditModals.WHAT_IS_NEEDED),
condition: this.canEdit,
},
],
];

return options
.filter(group => group.some(option => option.condition))
.map(group => group.filter(option => option.condition));
},
editLink() {
return {
name: RouteNames.CONTENTNODE_DETAILS,
Expand All @@ -102,15 +223,47 @@
}
},
},
beforeMount() {
this.lastFocus = document.activeElement;
},
mounted() {
this.focusFirstOption();
},
destroyed() {
this.lastFocus && this.lastFocus.focus();
},
methods: {
...mapActions(['showSnackbar', 'clearSnackbar']),
...mapActions('contentNode', [
'createContentNode',
'moveContentNodes',
'copyContentNode',
'waitForCopyingStatus',
'setQuickEditModal',
]),
...mapActions('clipboard', ['copy']),
async focusFirstOption() {
const { optionsList } = this.$refs;
const firstOption = optionsList.$el.querySelector('a');
let tries = 0;
while (document.activeElement !== firstOption && tries++ < 20) {
await new Promise(resolve => setTimeout(resolve, 0));
AlexVelezLl marked this conversation as resolved.
Show resolved Hide resolved
firstOption.focus();
}
},
checkTabBoundaries($event) {
const optionsList = this.$refs.optionsList;
const options = optionsList.$el.querySelectorAll('a');
const index = Array.from(options).indexOf($event.target);
if (
(index === 0 && $event.shiftKey) ||
(index === options.length - 1 && !$event.shiftKey)
) {
// destroy component
$event.preventDefault();
this.$destroy();
}
},
newTopicNode() {
this.trackAction('New topic');
const nodeData = {
Expand Down Expand Up @@ -155,6 +308,17 @@
// Otherwise, don't do anything
return () => {};
},
quickEditModalFactory(modal) {
return $event => {
$event.preventDefault();
this.setQuickEditModal({
modal,
nodeIds: [this.nodeId],
});
const trackActionLabel = modal.replace(/_/g, ' ').toLowerCase();
this.trackAction(`Edit ${trackActionLabel}`);
};
},
removeNode: withChangeTracker(function(changeTracker) {
this.trackAction('Delete');
const redirect = this.getRemoveNodeRedirect();
Expand Down Expand Up @@ -222,8 +386,17 @@

$trs: {
newSubtopic: 'New folder',
editTopicDetails: 'Edit folder details',
editDetails: 'Edit details',
editTitleDescription: 'Edit title and description',
editAllDetails: 'Edit all details',
editTags: 'Edit tags',
editLanguage: 'Edit language',
editCategories: 'Edit categories',
editLevels: 'Edit levels',
editLearningActivities: 'Edit learning activities',
editSource: 'Edit source',
editAudience: 'Edit audience',
editCompletion: 'Edit completion',
editWhatIsNeeded: "Edit 'what is needed'",
viewDetails: 'View details',
move: 'Move',
makeACopy: 'Make a copy',
Expand All @@ -240,5 +413,7 @@
</script>

<style scoped>

.divider {
margin: 8px 0!important;
}
</style>
Loading