Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
@@ -0,0 +1,164 @@
<template>

<KModal
v-if="value"
:title="title"
data-test="resubmit-modal"
@cancel="handleDismiss"
>
<div class="resubmit-modal-content">
<p class="resubmit-modal-description">{{ description }}</p>
<p class="resubmit-modal-question">{{ question }}</p>
</div>

<template #actions>
<div class="resubmit-modal-actions">
<KButton
class="resubmit-modal-dismiss-btn"
:style="dismissButtonStyles"
data-test="dismiss-button"
@click="handleDismiss"
>
{{ dismissButtonText }}
</KButton>
<KButton
class="resubmit-modal-resubmit-btn"
primary
data-test="resubmit-button"
@click="handleResubmit"
>
{{ resubmitButtonText }}
</KButton>
</div>
</template>
Comment on lines +14 to +33
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason why we need these buttons to be in the #actions slot instead of using the KModal props? (It is not completely incorrect, it is more so because this slot is just for when we want specific styles handling on KModal actions)

</KModal>

</template>


<script>
import { communityChannelsStrings } from 'shared/strings/communityChannelsStrings';
export default {
name: 'ResubmitChannelModal',
props: {
value: {
type: Boolean,
default: false,
},
channel: {
type: Object,
required: true,
validator(value) {
return value && typeof value.name === 'string' && typeof value.version === 'number';
},
},
},
computed: {
title() {
return communityChannelsStrings.resubmitModalTitle$();
},
description() {
return communityChannelsStrings.resubmitModalBodyFirst$({
channelName: this.channel.name,
version: this.channel.version,
});
},
question() {
return communityChannelsStrings.resubmitModalBodySecond$();
},
dismissButtonText() {
return communityChannelsStrings.dismissButton$();
},
resubmitButtonText() {
return communityChannelsStrings.resubmitButton$();
},
dismissButtonStyles() {
return {
color: this.$themeTokens.primary,
backgroundColor: this.$themePalette.grey.v_100,
'--hover-bg-color': this.$themePalette.grey.v_200,
};
},
},
methods: {
handleDismiss() {
this.$emit('dismiss');
this.$emit('input', false);
},
handleResubmit() {
this.$emit('resubmit');
this.$emit('input', false);
},
},
Comment on lines +58 to +94
Copy link
Member

Choose a reason for hiding this comment

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

Oh, and just one last thing! 😅 Could we migrate this to use the Vue Composition API instead? Thanks!

};
</script>


<style lang="scss">
[data-test='resubmit-modal'],
[data-test='resubmit-modal'] > *,
[data-test='resubmit-modal'] [role='dialog'],
[data-test='resubmit-modal'] .KModal,
[data-test='resubmit-modal'] .modal {
width: 500px !important;
max-width: 500px !important;
max-height: 284px !important;
}
[data-test='resubmit-modal'] h1,
[data-test='resubmit-modal'] h2,
[data-test='resubmit-modal'] h3,
[data-test='resubmit-modal'] h4,
[data-test='resubmit-modal'] .modal-title,
[data-test='resubmit-modal'] [class*='title'] {
width: 452px;
height: 52px;
font-family: 'Noto Sans', sans-serif;
font-size: 20px;
font-weight: 600;
line-height: 130%;
letter-spacing: 0%;
vertical-align: middle;
}
.resubmit-modal-content {
padding: 8px 0;
margin-top: 35px;
}
.resubmit-modal-description,
.resubmit-modal-question {
width: 100%;
min-height: 40px;
padding: 0;
margin: 0;
font-family: 'Noto Sans', sans-serif;
font-size: 14px;
font-weight: 400;
line-height: 140%;
letter-spacing: 0%;
vertical-align: middle;
}
.resubmit-modal-actions {
display: flex;
gap: 10px;
justify-content: flex-end;
width: 452px;
min-height: 40px;
padding-top: 16px;
}
.resubmit-modal-dismiss-btn:hover {
background-color: var(--hover-bg-color) !important;
}
.resubmit-modal-resubmit-btn {
height: 40px;
}
Comment on lines +102 to +162
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, are all of these styles added to match exactly the Figma specs? I don't think we need almost any of them; we can rely on KModal's inner styles to have a consistent view across modals in the application.

</style>
Copy link
Member

Choose a reason for hiding this comment

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

Should the resubmit CL modal be checked and triggered by this component? If so, we can show a loader here, until that check finishes, and then we can emit a showResubmitCommunityLibraryModal or something like that.

Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@
});
}

emit('published', { channelId: currentChannel.value.id });

await Channel.publish(currentChannel.value.id, version_notes.value);

emit('close');
Expand Down Expand Up @@ -402,7 +404,7 @@
};
},

emits: ['close'],
emits: ['close', 'published'],
};

</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,20 @@
<PublishSidePanel
v-if="showPublishSidePanel"
@close="showPublishSidePanel = false"
@published="handleChannelPublished"
/>
<SubmitToCommunityLibrarySidePanel
v-if="showSubmitToCommunityLibrarySidePanel"
:channel="currentChannel"
@close="showSubmitToCommunityLibrarySidePanel = false"
/>
<ResubmitChannelModal
v-if="resubmitModalChannel || currentChannel"
v-model="showResubmitModal"
:channel="resubmitModalChannel || currentChannel"
@resubmit="handleResubmit"
@dismiss="handleDismissResubmit"
/>
<template v-if="isPublished">
<ChannelTokenModal
v-model="showTokenModal"
Expand Down Expand Up @@ -349,6 +357,8 @@
import { DraggableRegions, DraggableUniverses, RouteNames } from '../../constants';
import PublishSidePanel from '../../components/sidePanels/PublishSidePanel';
import SubmitToCommunityLibrarySidePanel from '../../components/sidePanels/SubmitToCommunityLibrarySidePanel';
import ResubmitChannelModal from '../../components/modals/ResubmitChannelModal';
import { Channel, CommunityLibrarySubmission } from 'shared/data/resources';
import MainNavigationDrawer from 'shared/views/MainNavigationDrawer';
import ToolBar from 'shared/views/ToolBar';
import ChannelTokenModal from 'shared/views/channel/ChannelTokenModal';
Expand All @@ -369,6 +379,7 @@
ToolBar,
PublishSidePanel,
SubmitToCommunityLibrarySidePanel,
ResubmitChannelModal,
ProgressModal,
ChannelTokenModal,
SyncResourcesModal,
Expand All @@ -392,11 +403,13 @@
drawer: false,
showPublishSidePanel: false,
showSubmitToCommunityLibrarySidePanel: false,
showResubmitModal: false,
showTokenModal: false,
showSyncModal: false,
showClipboard: false,
showDeleteModal: false,
syncing: false,
resubmitModalChannel: null,
};
},
computed: {
Expand Down Expand Up @@ -546,6 +559,40 @@
this.showPublishSidePanel = true;
this.trackClickEvent('Publish');
},
handleResubmit() {
this.showResubmitModal = false;
this.showSubmitToCommunityLibrarySidePanel = true;
},
handleDismissResubmit() {
this.showResubmitModal = false;
this.resubmitModalChannel = null;
},
async handleChannelPublished({ channelId }) {
if (!channelId || !this.currentChannel || this.currentChannel.id !== channelId) {
return;
}
const response = await CommunityLibrarySubmission.fetchCollection({
channel: channelId,
max_results: 1,
});
let submissions = [];
if (Array.isArray(response)) {
submissions = response;
} else if (response && response.results && Array.isArray(response.results)) {
submissions = response.results;
}
Comment on lines +581 to +585
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to check the response type. In this point of the application, it should always be the same.

if (submissions.length > 0) {
const latestSubmission = submissions[0];
this.resubmitModalChannel = {
...this.currentChannel,
version: latestSubmission.channel_version,
};
Comment on lines +589 to +592
Copy link
Member

Choose a reason for hiding this comment

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

We won't need to update the channel version in this way after this is merged!

this.showResubmitModal = true;
}
},
trackClickEvent(eventLabel) {
this.$analytics.trackClick('channel_editor_toolbar', eventLabel);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,28 @@ export const communityChannelsStrings = createTranslator('CommunityChannelsStrin
message: 'I understand this will replace my earlier submission on the review queue',
context: 'Checkbox text shown when there is a pending submission to confirm replacement',
},
resubmitModalTitle: {
message: 'Resubmit channel for Community library review?',
context:
'Title of the modal shown after publishing a channel that already has Community Library submissions',
},
resubmitModalBodyFirst: {
message: '{channelName} v{version} is also published to the Community Library.',
context:
'First sentence of the body text of the modal shown after publishing a channel that already has Community Library submissions',
},
resubmitModalBodySecond: {
message:
'Would you like to resubmit this version with your changes for community library review?',
context:
'Second sentence of the body text of the modal shown after publishing a channel that already has Community Library submissions',
},
resubmitButton: {
message: 'RESUBMIT',
context: 'Button in the resubmit modal to open the submit to Community Library side panel',
},
dismissButton: {
message: 'DISMISS',
context: 'Button in the resubmit modal to dismiss the modal',
},
});
Loading