Skip to content

Commit

Permalink
chore: Improvements to utils to load article in widget (#7859)
Browse files Browse the repository at this point in the history
  • Loading branch information
nithindavid committed Sep 5, 2023
1 parent ce4cfee commit 9322112
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/javascript/sdk/sdk.js
Expand Up @@ -280,8 +280,8 @@ export const SDK_CSS = `
.woot-widget-holder {
border-radius: 16px;
bottom: 104px;
height: calc(85% - 64px - 20px);
max-height: 590px !important;
height: calc(90% - 64px - 20px);
max-height: 640px !important;
min-height: 250px !important;
width: 400px !important;
}
Expand Down
1 change: 1 addition & 0 deletions app/javascript/widget/api/endPoints.js
Expand Up @@ -97,6 +97,7 @@ const getMostReadArticles = (slug, locale) => ({
url: `/hc/${slug}/${locale}/articles.json`,
params: {
page: 1,
sort: 'views',
},
});

Expand Down
6 changes: 6 additions & 0 deletions app/javascript/widget/mixins/darkModeMixin.js
Expand Up @@ -3,6 +3,12 @@ import { mapGetters } from 'vuex';
export default {
computed: {
...mapGetters({ darkMode: 'appConfig/darkMode' }),
prefersDarkMode() {
const isOSOnDarkMode =
this.darkMode === 'auto' &&
window.matchMedia('(prefers-color-scheme: dark)').matches;
return isOSOnDarkMode || this.darkMode === 'dark';
},
},
methods: {
$dm(light, dark) {
Expand Down
Expand Up @@ -445,4 +445,33 @@ describe('#getters', () => {
};
expect(getters.getMessageCount(state)).toEqual(1);
});

it('getLastMessage', () => {
const state = {
conversations: {
1: {
id: 1,
content: 'Thanks for the help',
created_at: 1574075964,
message_type: 1,
},
2: {
id: 2,
content: 'Yes, It makes sense',
created_at: 1574092218,
message_type: 1,
},
3: {
id: 3,
content: 'Yes, It makes sense',
created_at: 1574092218,
message_type: 0,
},
},
meta: {
userLastSeenAt: 1674075964,
},
};
expect(getters.getLastMessage(state).id).toEqual(3);
});
});
4 changes: 3 additions & 1 deletion tailwind.config.js
Expand Up @@ -26,8 +26,8 @@ module.exports = {
],
theme: {
fontSize: {
xxs: '0.625rem',
...defaultTheme.fontSize,
xxs: '0.625rem',
},
colors: {
transparent: 'transparent',
Expand Down Expand Up @@ -127,6 +127,7 @@ module.exports = {
body: slateDark.slate7,
},
keyframes: {
...defaultTheme.keyframes,
wiggle: {
'0%': { transform: 'translateX(0)' },
'15%': { transform: 'translateX(0.375rem)' },
Expand All @@ -139,6 +140,7 @@ module.exports = {
},
},
animation: {
...defaultTheme.animation,
wiggle: 'wiggle 0.5s ease-in-out',
},
},
Expand Down

0 comments on commit 9322112

Please sign in to comment.