Skip to content

Commit 2632b0a

Browse files
Merge pull request #2512 from appwrite/revert-2491-revert-2477-copy-prompt
2 parents e662265 + d174af8 commit 2632b0a

File tree

12 files changed

+586
-22
lines changed

12 files changed

+586
-22
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
"@ai-sdk/svelte": "^1.1.24",
2525
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@315d6c5",
2626
"@appwrite.io/pink-icons": "0.25.0",
27-
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bd82d9a",
27+
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@6916470",
2828
"@appwrite.io/pink-legacy": "^1.0.3",
29-
"@appwrite.io/pink-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@bd82d9a",
29+
"@appwrite.io/pink-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@33845eb",
3030
"@faker-js/faker": "^9.9.0",
3131
"@popperjs/core": "^2.11.8",
3232
"@sentry/sveltekit": "^8.38.0",

pnpm-lock.yaml

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/actions/analytics.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ export enum Click {
195195
VariablesCreateClick = 'click_variable_create',
196196
VariablesUpdateClick = 'click_variable_update',
197197
VariablesImportClick = 'click_variable_import',
198-
WebsiteOpenClick = 'click_open_website'
198+
WebsiteOpenClick = 'click_open_website',
199+
CopyPromptStarterKitClick = 'click_copy_prompt_starter_kit',
200+
OpenInCursorClick = 'click_open_in_cursor',
201+
OpenInLovableClick = 'click_open_in_lovable'
199202
}
200203

201204
export enum Submit {

src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/icon/ai.svelte

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,4 @@
8282
aspect-ratio: 1/1;
8383
}
8484
}
85-
86-
:global(.ai-icon-holder.notification) {
87-
width: 36px !important;
88-
height: 32px !important;
89-
}
9085
</style>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script lang="ts">
2+
import { app } from '$lib/stores/app';
3+
import Light from '../assets/cursor-ai.svg';
4+
import Dark from '../assets/dark/cursor-ai.svg';
5+
</script>
6+
7+
<img src={$app.themeInUse === 'dark' ? Dark : Light} width="20" height="20" alt="Cursor" />

src/routes/(console)/project-[region]-[project]/overview/platforms/createAndroid.svelte

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import { Card } from '$lib/components';
1818
import { page } from '$app/state';
1919
import { onMount } from 'svelte';
20-
import { realtime, sdk } from '$lib/stores/sdk';
20+
import { getApiEndpoint, realtime, sdk } from '$lib/stores/sdk';
2121
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
2222
import { addNotification } from '$lib/stores/notifications';
2323
import { fade } from 'svelte/transition';
@@ -26,6 +26,7 @@
2626
import { PlatformType } from '@appwrite.io/console';
2727
import { project } from '../../store';
2828
import { getCorrectTitle, type PlatformProps } from './store';
29+
import LlmBanner from './llmBanner.svelte';
2930
3031
let { isConnectPlatform = false }: PlatformProps = $props();
3132
@@ -35,6 +36,60 @@
3536
let isPlatformCreated = $state(isConnectPlatform);
3637
3738
const projectId = page.params.project;
39+
const VERSIONS_ENDPOINT = (() => {
40+
const endpoint = getApiEndpoint(page.params.region);
41+
const url = new URL('/versions', endpoint);
42+
return url.toString();
43+
})();
44+
let androidSdkVersion = $state('11.3.0');
45+
46+
function buildAndroidInstructions(version: string) {
47+
return `
48+
Confirm you're working inside the correct Android project before editing anything:
49+
- Navigate into the directory that contains the real Android app module (look for gradlew, settings.gradle, and the app-level build.gradle(.kts)).
50+
- If Cursor opens in a parent folder (like your home directory) or you see multiple Android projects, ask which one to modify before making changes.
51+
- Update the app-level build.gradle.kts by default, but be ready to edit a Groovy build.gradle if the project hasn't migrated to Kotlin DSL yet.
52+
53+
Prefer Version Catalogs when adding the Appwrite SDK:
54+
1. If ./gradle/libs.versions.toml exists, add or reuse an Appwrite entry:
55+
\`\`\`toml
56+
[libraries]
57+
appwrite = { module = "io.appwrite:sdk-for-android", version = "${version}" }
58+
\`\`\`
59+
2. Reference it inside the module's dependencies block:
60+
\`\`\`kotlin
61+
dependencies {
62+
implementation(libs.appwrite)
63+
}
64+
\`\`\`
65+
Only when the project lacks ./gradle/libs.versions.toml should you hardcode the dependency:
66+
\`\`\`kotlin
67+
implementation("io.appwrite:sdk-for-android:${version}")
68+
\`\`\`
69+
Legacy Groovy scripts should use:
70+
\`\`\`groovy
71+
implementation "io.appwrite:sdk-for-android:${version}"
72+
\`\`\`
73+
74+
Before introducing any new files, search the project (app/src, libs/, shared modules, etc.) for existing Appwrite client helpers (look for \`Client(\`, \`AppwriteClient\`, or \`.setEndpoint\`). If a client already exists, update its configuration instead of creating a duplicate.
75+
76+
Ensure the Appwrite client is initialized with the application context and current project info:
77+
\`\`\`kotlin
78+
val client = Client(applicationContext)
79+
.setEndpoint("${sdk.forProject(page.params.region, page.params.project).client.config.endpoint}")
80+
.setProject("${projectId}")
81+
82+
val account = Account(client)
83+
\`\`\`
84+
85+
From the app's entry point (e.g., Application class or the first launched Activity), automatically invoke a helper that pings Appwrite so the user can verify connectivity and will be reflected on the Appwrite console:
86+
\`\`\`kotlin
87+
client.ping()
88+
\`\`\`
89+
`;
90+
}
91+
92+
const alreadyExistsInstructions = $derived(buildAndroidInstructions(androidSdkVersion));
3893
3994
const gitCloneCode =
4095
'\ngit clone https://github.com/appwrite/starter-for-android\ncd starter-for-android\n';
@@ -43,6 +98,22 @@
4398
const val APPWRITE_PROJECT_NAME = "${$project.name}"
4499
const val APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject(page.params.region, page.params.project).client.config.endpoint}"`;
45100
101+
async function fetchAndroidSdkVersion() {
102+
try {
103+
const response = await fetch(VERSIONS_ENDPOINT);
104+
if (!response.ok) {
105+
throw new Error(`Failed to fetch versions: ${response.status}`);
106+
}
107+
const data = await response.json();
108+
const latestVersion = data?.['client-android'];
109+
if (typeof latestVersion === 'string' && latestVersion.trim()) {
110+
androidSdkVersion = latestVersion.trim();
111+
}
112+
} catch (error) {
113+
console.error('Unable to fetch latest Android SDK version', error);
114+
}
115+
}
116+
46117
async function createAndroidPlatform() {
47118
try {
48119
isCreatingPlatform = true;
@@ -83,6 +154,7 @@ const val APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject(page.params.region, page.
83154
}
84155
85156
onMount(() => {
157+
fetchAndroidSdkVersion();
86158
const unsubscribe = realtime.forConsole(page.params.region, 'console', (response) => {
87159
if (response.events.includes(`projects.${projectId}.ping`)) {
88160
connectionSuccessful = true;
@@ -171,6 +243,12 @@ const val APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject(page.params.region, page.
171243
{#if isPlatformCreated}
172244
<Fieldset legend="Clone starter" badge="Optional">
173245
<Layout.Stack gap="l">
246+
<LlmBanner
247+
platform="android"
248+
{configCode}
249+
{alreadyExistsInstructions}
250+
openers={['cursor']} />
251+
174252
<Typography.Text variant="m-500">
175253
1. If you're starting a new project, you can clone our starter kit from
176254
GitHub using the terminal, VSCode or Android Studio.

src/routes/(console)/project-[region]-[project]/overview/platforms/createApple.svelte

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import { app } from '$lib/stores/app';
2929
import { project } from '../../store';
3030
import { getCorrectTitle, type PlatformProps } from './store';
31+
import LlmBanner from './llmBanner.svelte';
3132
3233
let { isConnectPlatform = false, platform = PlatformType.Appleios }: PlatformProps = $props();
3334
@@ -38,14 +39,38 @@
3839
3940
const projectId = page.params.project;
4041
42+
const alreadyExistsInstructions = `
43+
Install the Appwrite iOS SDK using the following package URL:
44+
45+
\`\`\`
46+
https://github.com/appwrite/sdk-for-apple
47+
\`\`\`
48+
49+
From a suitable lib directory, export the Appwrite client as a global variable:
50+
51+
\`\`\`
52+
let client = Client()
53+
.setEndpoint("${sdk.forProject(page.params.region, page.params.project).client.config.endpoint}")
54+
.setProject("${projectId}")
55+
56+
let account = Account(client)
57+
\`\`\`
58+
59+
On the homepage of the app, create a button that says "Send a ping" and when clicked, it should call the following function:
60+
61+
\`\`\`
62+
client.ping()
63+
\`\`\`
64+
`;
65+
4166
const gitCloneCode =
4267
'\ngit clone https://github.com/appwrite/starter-for-ios\ncd starter-for-ios\n';
4368
4469
const configCode = `APPWRITE_PROJECT_ID: "${projectId}"
4570
APPWRITE_PROJECT_NAME: "${$project.name}"
4671
APPWRITE_PUBLIC_ENDPOINT: "${sdk.forProject(page.params.region, page.params.project).client.config.endpoint}"`;
4772
48-
let platforms: { [key: string]: PlatformType } = {
73+
const platforms: { [key: string]: PlatformType } = {
4974
iOS: PlatformType.Appleios,
5075
macOS: PlatformType.Applemacos,
5176
watchOS: PlatformType.Applewatchos,
@@ -199,6 +224,12 @@ APPWRITE_PUBLIC_ENDPOINT: "${sdk.forProject(page.params.region, page.params.proj
199224
{#if isPlatformCreated}
200225
<Fieldset legend="Clone starter" badge="Optional">
201226
<Layout.Stack gap="l">
227+
<LlmBanner
228+
platform="apple"
229+
{configCode}
230+
{alreadyExistsInstructions}
231+
openers={['cursor']} />
232+
202233
<Typography.Text variant="m-500">
203234
1. If you're starting a new project, you can clone our starter kit from
204235
GitHub using the terminal or XCode.

src/routes/(console)/project-[region]-[project]/overview/platforms/createFlutter.svelte

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import { Card } from '$lib/components';
1919
import { page } from '$app/state';
2020
import { onMount } from 'svelte';
21-
import { realtime, sdk } from '$lib/stores/sdk';
21+
import { getApiEndpoint, realtime, sdk } from '$lib/stores/sdk';
2222
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
2323
import { addNotification } from '$lib/stores/notifications';
2424
import { fade } from 'svelte/transition';
@@ -27,6 +27,7 @@
2727
import { PlatformType } from '@appwrite.io/console';
2828
import { project } from '../../store';
2929
import { getCorrectTitle, type PlatformProps } from './store';
30+
import LlmBanner from './llmBanner.svelte';
3031
3132
let { isConnectPlatform = false, platform = PlatformType.Flutterandroid }: PlatformProps =
3233
$props();
@@ -37,6 +38,38 @@
3738
let isPlatformCreated = $state(isConnectPlatform);
3839
3940
const projectId = page.params.project;
41+
const VERSIONS_ENDPOINT = (() => {
42+
const endpoint = getApiEndpoint(page.params.region);
43+
const url = new URL('/versions', endpoint);
44+
return url.toString();
45+
})();
46+
let flutterSdkVersion = $state('20.3.0');
47+
48+
function buildFlutterInstructions(version: string) {
49+
return `
50+
Install the Appwrite Flutter SDK using the following command:
51+
52+
\`\`\`
53+
flutter pub add appwrite:${version}
54+
\`\`\`
55+
56+
From a suitable lib directory, export the Appwrite client as a global variable, hardcode the project details too:
57+
58+
\`\`\`
59+
final Client client = Client()
60+
.setProject("${projectId}")
61+
.setEndpoint("${sdk.forProject(page.params.region, page.params.project).client.config.endpoint}");
62+
\`\`\`
63+
64+
On the homepage of the app, create a button that says "Send a ping" and when clicked, it should call the following function:
65+
66+
\`\`\`
67+
client.ping();
68+
\`\`\`
69+
`;
70+
}
71+
72+
const alreadyExistsInstructions = $derived(buildFlutterInstructions(flutterSdkVersion));
4073
4174
const gitCloneCode =
4275
'\ngit clone https://github.com/appwrite/starter-for-flutter\ncd starter-for-flutter\n';
@@ -111,6 +144,22 @@
111144
[PlatformType.Flutterwindows]: 'Package name'
112145
};
113146
147+
async function fetchFlutterSdkVersion() {
148+
try {
149+
const response = await fetch(VERSIONS_ENDPOINT);
150+
if (!response.ok) {
151+
throw new Error(`Failed to fetch versions: ${response.status}`);
152+
}
153+
const data = await response.json();
154+
const latestVersion = data?.['client-flutter'];
155+
if (typeof latestVersion === 'string' && latestVersion.trim()) {
156+
flutterSdkVersion = latestVersion.trim();
157+
}
158+
} catch (error) {
159+
console.error('Unable to fetch latest Flutter SDK version', error);
160+
}
161+
}
162+
114163
async function createFlutterPlatform() {
115164
try {
116165
isCreatingPlatform = true;
@@ -158,6 +207,7 @@
158207
}
159208
160209
onMount(() => {
210+
fetchFlutterSdkVersion();
161211
const unsubscribe = realtime.forConsole(page.params.region, 'console', (response) => {
162212
if (response.events.includes(`projects.${projectId}.ping`)) {
163213
connectionSuccessful = true;
@@ -281,6 +331,11 @@
281331
{#if isPlatformCreated}
282332
<Fieldset legend="Clone starter" badge="Optional">
283333
<Layout.Stack gap="l">
334+
<LlmBanner
335+
platform="flutter"
336+
{configCode}
337+
{alreadyExistsInstructions}
338+
openers={['cursor']} />
284339
<Typography.Text variant="m-500">
285340
1. If you're starting a new project, you can clone our starter kit from
286341
GitHub using the terminal, VSCode or Android Studio.

0 commit comments

Comments
 (0)