* fix: remove unused imports and variables (part 1) Resolve oxlint no-unused-vars warnings in packages/*, apps/admin, apps/space, apps/live, and apps/web (non-core). * fix: resolve CI check failures * fix: resolve check:types failures * fix: resolve check:types and check:format failures - Use destructuring alias for activeCycleResolvedPath - Format propel tab-navigation file * fix: format propel button helper with oxfmt Reorder Tailwind classes to match oxfmt canonical ordering.
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
/**
|
|
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* See the LICENSE file for details.
|
|
*/
|
|
|
|
import { action, makeObservable, observable, runInAction } from "mobx";
|
|
// plane imports
|
|
import { SitesCycleService } from "@plane/services";
|
|
import type { TPublicCycle } from "@/types/cycle";
|
|
// store
|
|
import type { RootStore } from "./root.store";
|
|
|
|
export interface ICycleStore {
|
|
// observables
|
|
cycles: TPublicCycle[] | undefined;
|
|
// computed actions
|
|
getCycleById: (cycleId: string | undefined) => TPublicCycle | undefined;
|
|
// fetch actions
|
|
fetchCycles: (anchor: string) => Promise<TPublicCycle[]>;
|
|
}
|
|
|
|
export class CycleStore implements ICycleStore {
|
|
cycles: TPublicCycle[] | undefined = undefined;
|
|
cycleService: SitesCycleService;
|
|
rootStore: RootStore;
|
|
|
|
constructor(_rootStore: RootStore) {
|
|
makeObservable(this, {
|
|
// observables
|
|
cycles: observable,
|
|
// fetch action
|
|
fetchCycles: action,
|
|
});
|
|
this.cycleService = new SitesCycleService();
|
|
this.rootStore = _rootStore;
|
|
}
|
|
|
|
getCycleById = (cycleId: string | undefined) => this.cycles?.find((cycle) => cycle.id === cycleId);
|
|
|
|
fetchCycles = async (anchor: string) => {
|
|
const cyclesResponse = await this.cycleService.list(anchor);
|
|
runInAction(() => {
|
|
this.cycles = cyclesResponse;
|
|
});
|
|
return cyclesResponse;
|
|
};
|
|
}
|