mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
* dev: change layout * chore: replace workspace slug and project id with anchor * chore: migration fixes * chore: update filtering logic * chore: endpoint changes * chore: update endpoint * chore: changed url pratterns * chore: use client side for layout and page * chore: issue vote changes * chore: project deploy board response change * refactor: publish project store and components * fix: update layout options after fetching settings * chore: remove unnecessary types * style: peek overview * refactor: components folder structure * fix: redirect from old path * chore: make the whole issue block clickable * chore: removed the migration file * chore: add server side redirection for old routes * chore: is enabled key change * chore: update types * chore: removed the migration file --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import set from "lodash/set";
|
|
import { makeObservable, observable, runInAction, action } from "mobx";
|
|
// services
|
|
import PublishService from "@/services/publish.service";
|
|
// store
|
|
import { PublishStore } from "@/store/publish/publish.store";
|
|
// store
|
|
import { TPublishSettings } from "@/types/publish";
|
|
import { RootStore } from "../root.store";
|
|
|
|
export interface IPublishListStore {
|
|
// observables
|
|
publishMap: Record<string, PublishStore>; // anchor => PublishStore
|
|
// actions
|
|
fetchPublishSettings: (pageId: string) => Promise<TPublishSettings>;
|
|
}
|
|
|
|
export class PublishListStore implements IPublishListStore {
|
|
// observables
|
|
publishMap: Record<string, PublishStore> = {}; // anchor => PublishStore
|
|
// service
|
|
publishService;
|
|
|
|
constructor(private store: RootStore) {
|
|
makeObservable(this, {
|
|
// observables
|
|
publishMap: observable,
|
|
// actions
|
|
fetchPublishSettings: action,
|
|
});
|
|
// services
|
|
this.publishService = new PublishService();
|
|
}
|
|
|
|
/**
|
|
* @description fetch publish settings
|
|
* @param {string} anchor
|
|
*/
|
|
fetchPublishSettings = async (anchor: string) => {
|
|
try {
|
|
const response = await this.publishService.fetchPublishSettings(anchor);
|
|
runInAction(() => {
|
|
if (response.anchor && response.view_props) {
|
|
this.store.issueFilter.updateLayoutOptions(response?.view_props);
|
|
set(this.publishMap, [response.anchor], new PublishStore(this.store, response));
|
|
}
|
|
});
|
|
|
|
return response;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
};
|
|
}
|