Skip to content

Commit 2456bb3

Browse files
committed
fix npm check errors
1 parent df282a7 commit 2456bb3

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

src/lib/components/billing/alerts/projectsLimit.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99
upgradeURL
1010
} from '$lib/stores/billing';
1111
import { currentPlan } from '$lib/stores/organization';
12+
import { onMount } from 'svelte';
1213
import SelectProjectCloud from './selectProjectCloud.svelte';
13-
let showSelectProject = $state(false);
14+
let showSelectProject: boolean = $state(false);
15+
let selectedProjects: string[] = $state([]);
16+
onMount(() => {
17+
selectedProjects = page.data.organization?.projects || [];
18+
});
1419
</script>
1520

16-
<SelectProjectCloud bind:showSelectProject />
21+
<SelectProjectCloud bind:showSelectProject bind:selectedProjects />
1722

1823
{#if $currentPlan && $currentPlan.projects > 0 && !hideBillingHeaderRoutes.includes(page.url.pathname)}
1924
<HeaderAlert

src/lib/components/billing/alerts/selectProjectCloud.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
let {
1616
showSelectProject = $bindable(false),
17-
selectedProjects = []
17+
selectedProjects = $bindable([])
1818
}: {
1919
showSelectProject: boolean;
2020
selectedProjects: string[];

src/routes/(console)/+layout.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@
297297
if (currentOrganizationId === org.$id) return;
298298
if (isCloud) {
299299
currentOrganizationId = org.$id;
300-
checkForProjectsLimit(org, data.projects?.length || 0);
300+
checkForProjectsLimit(org, data.projects?.projects?.length || 0);
301301
checkForEnterpriseTrial(org);
302302
await checkForUsageLimit(org);
303303
checkForMarkedForDeletion(org);

src/routes/(console)/+layout.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { LayoutLoad } from './$types';
44
import { Dependencies } from '$lib/constants';
55
import type { Tier } from '$lib/stores/billing';
66
import type { Plan, PlanList } from '$lib/sdk/billing';
7+
import { Query } from '@appwrite.io/console';
78

89
export const load: LayoutLoad = async ({ depends, parent }) => {
910
const { organizations } = await parent();
@@ -28,6 +29,20 @@ export const load: LayoutLoad = async ({ depends, parent }) => {
2829
preferences.organization ??
2930
(organizations.teams.length > 0 ? organizations.teams[0].$id : undefined);
3031

32+
// Load projects for the current organization if one is selected
33+
let projects = null;
34+
if (currentOrgId) {
35+
try {
36+
projects = await sdk.forConsole.projects.list([
37+
Query.equal('teamId', currentOrgId),
38+
Query.limit(1000) // Get all projects for organization
39+
]);
40+
} catch (e) {
41+
// Handle error silently - projects might not be accessible
42+
projects = {};
43+
}
44+
}
45+
3146
return {
3247
plansInfo,
3348
roles: [],
@@ -36,7 +51,8 @@ export const load: LayoutLoad = async ({ depends, parent }) => {
3651
currentOrgId,
3752
organizations,
3853
consoleVariables,
39-
version: versionData?.version ?? null
54+
version: versionData?.version ?? null,
55+
projects
4056
};
4157
};
4258

0 commit comments

Comments
 (0)