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 { const CopyStatus = {
Copy = 'Copy', Copy: 'Copy',
Copied = 'Copied!' Copied: 'Copied!'
} } as const;
let copyText = CopyStatus.Copy; let copyText = CopyStatus.Copy;
async function handleCopy() { async function handleCopy() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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