enums to objects

This commit is contained in:
Jesse Winton
2025-04-01 12:29:49 -04:00
parent d3b5846f9e
commit 687a05e34d
13 changed files with 103 additions and 102 deletions

View File

@@ -22,10 +22,10 @@
}
});
const enum CopyStatus {
Copy = 'Copy',
Copied = 'Copied!'
}
const CopyStatus = {
Copy: 'Copy',
Copied: 'Copied!'
} as const;
let copyText = CopyStatus.Copy;
async function handleCopy() {

View File

@@ -11,11 +11,11 @@ client.setEndpoint(PUBLIC_APPWRITE_ENDPOINT).setProject('console');
const account = new Account(client);
const teams = new Teams(client);
enum BillingPlan {
STARTER = 'tier-0',
PRO = 'tier-1',
SCALE = 'tier-2'
}
const BillingPlan = {
STARTER: 'tier-0',
PRO: 'tier-1',
SCALE: 'tier-2'
} as const;
export async function createSource(
ref: string | null,

View File

@@ -20,51 +20,51 @@ export const versions: Readonly<Array<Omit<Version, 'cloud'>>> = allVersions.fil
(v) => v !== 'cloud'
);
export enum Service {
Account = 'account',
Avatars = 'avatars',
Databases = 'databases',
Functions = 'functions',
Messaging = 'messaging',
Health = 'health',
Locale = 'locale',
Storage = 'storage',
Teams = 'teams',
Users = 'users'
}
export const Service = {
Account: 'account',
Avatars: 'avatars',
Databases: 'databases',
Functions: 'functions',
Messaging: 'messaging',
Health: 'health',
Locale: 'locale',
Storage: 'storage',
Teams: 'teams',
Users: 'users'
} as const;
export enum Platform {
ClientWeb = 'client-web',
ClientFlutter = 'client-flutter',
ClientReactNative = 'client-react-native',
ClientApple = 'client-apple',
ClientAndroidKotlin = 'client-android-kotlin',
ClientAndroidJava = 'client-android-java',
ClientGraphql = 'client-graphql',
ClientRest = 'client-rest',
ServerNodeJs = 'server-nodejs',
ServerPython = 'server-python',
ServerDart = 'server-dart',
ServerPhp = 'server-php',
ServerRuby = 'server-ruby',
ServerDotNet = 'server-dotnet',
ServerDeno = 'server-deno',
ServerGo = 'server-go',
ServerSwift = 'server-swift',
ServerKotlin = 'server-kotlin',
ServerJava = 'server-java',
ServerGraphql = 'server-graphql',
ServerRest = 'server-rest'
}
export const Platform = {
ClientWeb: 'client-web',
ClientFlutter: 'client-flutter',
ClientReactNative: 'client-react-native',
ClientApple: 'client-apple',
ClientAndroidKotlin: 'client-android-kotlin',
ClientAndroidJava: 'client-android-java',
ClientGraphql: 'client-graphql',
ClientRest: 'client-rest',
ServerNodeJs: 'server-nodejs',
ServerPython: 'server-python',
ServerDart: 'server-dart',
ServerPhp: 'server-php',
ServerRuby: 'server-ruby',
ServerDotNet: 'server-dotnet',
ServerDeno: 'server-deno',
ServerGo: 'server-go',
ServerSwift: 'server-swift',
ServerKotlin: 'server-kotlin',
ServerJava: 'server-java',
ServerGraphql: 'server-graphql',
ServerRest: 'server-rest'
} as const;
export enum Framework {
NextJs = 'Next.js',
SvelteKit = 'SvelteKit',
VueJs = 'Vue.js',
Nuxt3 = 'Nuxt3',
Astro = 'Astro',
Remix = 'Remix'
}
export const Framework = {
NextJs: 'Next.js',
SvelteKit: 'SvelteKit',
VueJs: 'Vue.js',
Nuxt3: 'Nuxt3',
Astro: 'Astro',
Remix: 'Remix'
} as const;
export const platformMap: Record<Language | string, string> = {
[Platform.ClientApple]: 'Apple',

View File

@@ -60,10 +60,10 @@ export interface Property {
} & OpenAPIV3.ReferenceObject;
}
export enum ModelType {
REST = 'REST',
GRAPHQL = 'GraphQL'
}
export const ModelType = {
REST: 'REST',
GRAPHQL: 'GraphQL'
} as const;
function getExamples(version: string) {
switch (version) {

View File

@@ -31,10 +31,10 @@
const insideMultiCode = hasContext('multi-code');
const selected = insideMultiCode ? getContext<CodeContext>('multi-code').selected : null;
const enum CopyStatus {
Copy = 'Copy',
Copied = 'Copied!'
}
const CopyStatus = {
Copy: 'Copy',
Copied: 'Copied!'
} as const;
let copyText = $state(CopyStatus.Copy);
async function handleCopy() {

View File

@@ -48,10 +48,11 @@
}
});
const enum CopyStatus {
Copy = 'Copy',
Copied = 'Copied!'
}
const CopyStatus = {
Copy: 'Copy',
Copied: 'Copied!'
} as const;
let copyText = $state(CopyStatus.Copy);
async function handleCopy() {

View File

@@ -10,19 +10,19 @@
import MainFooter from '../../lib/components/MainFooter.svelte';
import Copy from './Copy.svelte';
const title = 'Assets' + TITLE_SUFFIX;
const title: 'Assets' + TITLE_SUFFIX;
const description =
"This page features Appwrite's key brand assets including the logotype, colors, product visuals, and practical guidelines for their usage.";
const ogImage = DEFAULT_HOST + '/images/open-graph/website.png';
enum Section {
NAMING = 'Naming',
LOGOTYPE = 'Logotype',
LOGOMARK = 'Logomark',
COLORS = 'Brand colors',
VISUALS = 'Product visuals',
CONTACT = 'Contact us'
}
const Section = {
NAMING: 'Naming',
LOGOTYPE: 'Logotype',
LOGOMARK: 'Logomark',
COLORS: 'Brand colors',
VISUALS: 'Product visuals',
CONTACT: 'Contact us'
} as const
const getSectionId = (section: Section) => section.toLowerCase().replace(/\s/g, '-');

View File

@@ -21,10 +21,10 @@
const sharingOptions = socialSharingOptions.filter((option) => option.label !== 'YCombinator');
const enum CopyStatus {
Copy = 'Copy',
Copied = 'Copied!'
}
const CopyStatus = {
Copy: 'Copy',
Copied: 'Copied!'
} as const;
let copyText = CopyStatus.Copy;
async function handleCopy() {

View File

@@ -8,15 +8,15 @@
const rateTime = method['rate-time'];
const rateLimit = method['rate-limit'];
enum RateKeys {
'ip' = 'IP',
'userId' = 'USER ID',
'url' = 'URL',
'phone' = 'PHONE',
'token' = 'TOKEN',
'method' = 'METHOD',
'email' = 'EMAIL'
}
const RateKeys = {
ip: 'IP',
userId: 'USER ID',
url: 'URL',
phone: 'PHONE',
token: 'TOKEN',
method: 'METHOD',
email: 'EMAIL'
} as const;
function hasMultipleKeys(keys: string | string[]): keys is string[] {
if (Array.isArray(keys)) {

View File

@@ -22,10 +22,10 @@
}
});
const enum CopyStatus {
Copy = 'Copy',
Copied = 'Copied!'
}
const CopyStatus = {
Copy: 'Copy',
Copied: 'Copied!'
} as const;
let copyText = CopyStatus.Copy;
async function handleCopy() {

View File

@@ -22,10 +22,10 @@
}
});
const enum CopyStatus {
Copy = 'Copy',
Copied = 'Copied!'
}
const CopyStatus = {
Copy: 'Copy',
Copied: 'Copied!'
} as const;
let copyText = CopyStatus.Copy;
async function handleCopy() {

View File

@@ -22,10 +22,10 @@
}
});
const enum CopyStatus {
Copy = 'Copy',
Copied = 'Copied!'
}
const CopyStatus = {
Copy: 'Copy',
Copied: 'Copied!'
} as const;
let copyText = CopyStatus.Copy;
async function handleCopy() {
await copy(content);

View File

@@ -17,10 +17,10 @@
const insideMultiCode = hasContext('multi-code');
const selected = insideMultiCode ? getContext<CodeContext>('multi-code').selected : null;
const enum CopyStatus {
Copy = 'Copy',
Copied = 'Copied!'
}
const CopyStatus = {
Copy: 'Copy',
Copied: 'Copied!'
} as const;
let copyText = CopyStatus.Copy;
async function handleCopy() {