feat(v4): Update the help center portal design (#10296)
Co-authored-by: Pranav <pranavrajs@gmail.com>
This commit is contained in:
@@ -30,10 +30,8 @@ export const mutations = {
|
||||
$state.articles.allIds.push(...articleIds);
|
||||
},
|
||||
|
||||
[types.SET_ARTICLES_META]: ($state, data) => {
|
||||
const { articles_count: count, current_page: currentPage } = data;
|
||||
$state.meta.count = count;
|
||||
$state.meta.currentPage = currentPage;
|
||||
[types.SET_ARTICLES_META]: ($state, meta) => {
|
||||
$state.meta = meta;
|
||||
},
|
||||
|
||||
[types.ADD_ARTICLE_ID]: ($state, articleId) => {
|
||||
@@ -41,8 +39,7 @@ export const mutations = {
|
||||
$state.articles.allIds.push(articleId);
|
||||
},
|
||||
[types.UPDATE_ARTICLE_FLAG]: ($state, { articleId, uiFlags }) => {
|
||||
const flags =
|
||||
Object.keys($state.articles.uiFlags.byId).includes(articleId) || {};
|
||||
const flags = $state.articles.uiFlags.byId[articleId] || {};
|
||||
|
||||
$state.articles.uiFlags.byId[articleId] = {
|
||||
...{
|
||||
@@ -64,11 +61,19 @@ export const mutations = {
|
||||
...uiFlags,
|
||||
};
|
||||
},
|
||||
[types.UPDATE_ARTICLE]($state, article) {
|
||||
const articleId = article.id;
|
||||
if (!$state.articles.allIds.includes(articleId)) return;
|
||||
[types.UPDATE_ARTICLE]: ($state, updatedArticle) => {
|
||||
const articleId = updatedArticle.id;
|
||||
if ($state.articles.byId[articleId]) {
|
||||
// Preserve the original position
|
||||
const originalPosition = $state.articles.byId[articleId].position;
|
||||
|
||||
$state.articles.byId[articleId] = { ...article };
|
||||
// Update the article, keeping the original position
|
||||
// This is not moved out of the original position when we update the article
|
||||
$state.articles.byId[articleId] = {
|
||||
...updatedArticle,
|
||||
position: originalPosition,
|
||||
};
|
||||
}
|
||||
},
|
||||
[types.REMOVE_ARTICLE]($state, articleId) {
|
||||
const { [articleId]: toBeRemoved, ...newById } = $state.articles.byId;
|
||||
|
||||
Reference in New Issue
Block a user