Skip to content

Commit d12c622

Browse files
authored
Merge branch 'unstable' into dependabot/npm_and_yarn/axios-1.12.2
2 parents 7454dd8 + 6db4e05 commit d12c622

45 files changed

Lines changed: 1839 additions & 507 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎contentcuration/contentcuration/frontend/accounts/pages/AccountsMain.vue‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@
5353
:label="$tr('passwordLabel')"
5454
/>
5555
<p>
56-
<ActionLink
56+
<KRouterLink
5757
:to="{ name: 'ForgotPassword' }"
5858
:text="$tr('forgotPasswordLink')"
59+
appearance="basic-link"
5960
/>
6061
</p>
6162
<KButton
@@ -75,9 +76,10 @@
7576
</VForm>
7677
<VDivider />
7778
<p class="mt-4 text-xs-center">
78-
<ActionLink
79+
<KButton
7980
href="/channels"
8081
:text="$tr('guestModeLink')"
82+
appearance="basic-link"
8183
/>
8284
</p>
8385
</VCard>
@@ -87,21 +89,25 @@
8789

8890
<p class="links mt-3 text-xs-center">
8991
<span>
90-
<ActionLink
92+
<KButton
9193
:text="$tr('privacyPolicyLink')"
94+
appearance="basic-link"
9295
@click="showPrivacyPolicy"
9396
/>
9497
</span>
9598
<span>
96-
<ActionLink
99+
<KButton
97100
:text="$tr('TOSLink')"
101+
appearance="basic-link"
98102
@click="showTermsOfService"
99103
/>
100104
</span>
101105
<span>
102-
<ActionLink
103-
:text="$tr('copyright', { year: new Date().getFullYear() })"
106+
<KButton
104107
href="https://learningequality.org/"
108+
:text="$tr('copyright', { year: new Date().getFullYear() })"
109+
appearance="basic-link"
110+
iconAfter="openNewTab"
105111
target="_blank"
106112
/>
107113
</span>

‎contentcuration/contentcuration/frontend/accounts/pages/accountDeleted/AccountDeleted.vue‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
<MessageLayout :header="$tr('accountDeletedTitle')">
44
<template #back>
5-
<VBtn
6-
color="primary"
5+
<KRouterLink
76
:to="{ name: 'Main' }"
8-
large
9-
>
10-
{{ $tr('backToLogin') }}
11-
</VBtn>
7+
:text="$tr('backToLogin')"
8+
:primary="true"
9+
appearance="raised-button"
10+
/>
1211
</template>
1312
</MessageLayout>
1413

‎contentcuration/contentcuration/frontend/accounts/pages/activateAccount/AccountCreated.vue‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
<MessageLayout :header="$tr('accountCreatedTitle')">
44
<template #back>
5-
<VBtn
6-
color="primary"
5+
<KRouterLink
76
:to="{ name: 'Main' }"
8-
large
9-
>
10-
{{ $tr('backToLogin') }}
11-
</VBtn>
7+
:text="$tr('backToLogin')"
8+
:primary="true"
9+
appearance="raised-button"
10+
/>
1211
</template>
1312
</MessageLayout>
1413

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<template>
2+
3+
<!-- At the time of writing, the KLabeledIcon component does not set
4+
the color of the label properly (issue #1102). When this is fixed, setting
5+
color on the button component should no longer be needed. -->
6+
<button
7+
class="community-library-status-button"
8+
:title="tooltip"
9+
@click="$emit('click')"
10+
>
11+
<KLabeledIcon
12+
:icon="icon"
13+
iconAfter="dropdown"
14+
:color="labelColor"
15+
:label="text"
16+
/>
17+
</button>
18+
19+
</template>
20+
21+
22+
<script>
23+
24+
import { themePalette } from 'kolibri-design-system/lib/styles/theme';
25+
import { computed, defineComponent } from 'vue';
26+
import { CommunityLibraryStatus } from 'shared/constants';
27+
28+
export default defineComponent({
29+
name: 'ChannelCommunityLibraryStatusButton',
30+
setup(props) {
31+
const theme = themePalette();
32+
33+
const configChoices = {
34+
[CommunityLibraryStatus.PENDING]: {
35+
text: 'Submitted',
36+
tooltip: 'Submission awaiting review',
37+
color: theme.yellow.v_100,
38+
darkColor: theme.yellow.v_200,
39+
labelColor: theme.orange.v_600,
40+
icon: 'schedule',
41+
},
42+
[CommunityLibraryStatus.APPROVED]: {
43+
text: 'Approved',
44+
tooltip: 'Live in Community Library',
45+
color: theme.green.v_100,
46+
darkColor: theme.green.v_200,
47+
labelColor: theme.green.v_600,
48+
icon: 'circleCheckmark',
49+
},
50+
[CommunityLibraryStatus.REJECTED]: {
51+
text: 'Flagged',
52+
tooltip: 'Review flagged submission',
53+
color: theme.red.v_100,
54+
darkColor: theme.red.v_200,
55+
labelColor: theme.red.v_600,
56+
icon: 'error',
57+
},
58+
};
59+
60+
// NOTE: Having the whole config object as a computed property and
61+
// then accessing its elements breaks tests (possibly because of quirks
62+
// of how vue-jest and vue-template-compiler handle computed properties
63+
// defined using the composition API).
64+
// Therefore, we define the individual attributes as separate
65+
// computed properties as a workaround.
66+
const text = computed(() => configChoices[props.status].text);
67+
const tooltip = computed(() => configChoices[props.status].tooltip);
68+
const color = computed(() => configChoices[props.status].color);
69+
const darkColor = computed(() => configChoices[props.status].darkColor);
70+
const labelColor = computed(() => configChoices[props.status].labelColor);
71+
const icon = computed(() => configChoices[props.status].icon);
72+
73+
return {
74+
text,
75+
tooltip,
76+
color,
77+
darkColor,
78+
labelColor,
79+
icon,
80+
};
81+
},
82+
// NOTE: Values of props declared in the setup method using `declareProps` cannot
83+
// be checked in tests, so we declare them using the options API for better testability.
84+
props: {
85+
status: {
86+
type: String,
87+
required: true,
88+
validator: value =>
89+
[
90+
CommunityLibraryStatus.PENDING,
91+
CommunityLibraryStatus.APPROVED,
92+
CommunityLibraryStatus.REJECTED,
93+
].includes(value),
94+
},
95+
},
96+
});
97+
98+
</script>
99+
100+
101+
<style lang="scss" scoped>
102+
103+
@import '~kolibri-design-system/lib/styles/definitions';
104+
105+
.community-library-status-button {
106+
@extend %md-standard-func;
107+
108+
width: 9em;
109+
padding: 4px;
110+
color: v-bind('labelColor');
111+
background-color: v-bind('color');
112+
border-radius: 16px;
113+
transition: background-color $core-time;
114+
}
115+
116+
.community-library-status-button:hover {
117+
background-color: v-bind('darkColor');
118+
}
119+
120+
</style>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { mount } from '@vue/test-utils';
2+
import CommunityLibraryStatusButton from '../CommunityLibraryStatusButton.vue';
3+
import { CommunityLibraryStatus } from 'shared/constants';
4+
5+
describe('CommunityLibraryStatusButton', () => {
6+
it('pushing the button emits the click event', () => {
7+
const wrapper = mount(CommunityLibraryStatusButton, {
8+
propsData: {
9+
status: CommunityLibraryStatus.APPROVED,
10+
},
11+
});
12+
wrapper.find('button').trigger('click');
13+
14+
expect(wrapper.emitted('click')).toBeTruthy();
15+
});
16+
});

0 commit comments

Comments
 (0)