mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
add tests for stirngs helpers, fix leftover mistakes from merge
This commit is contained in:
1 parent
f55c5865e8
commit
e9510db0ba
5 files changed
+122
-4
No files matched your search
@@ -20,3 +20,23 @@ export function capitalize(str: string): string {
|
||||
export function singular(str: string): string {
|
||||
return str.replace(/s$/, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a dash/underscore/space separated string to camelCase.
|
||||
*
|
||||
* @export
|
||||
* @param {string} str - The string to convert.
|
||||
* @returns {string} The camelized string.
|
||||
*/
|
||||
export function camelize(str: string): string {
|
||||
if (!str) {
|
||||
return '';
|
||||
}
|
||||
return str
|
||||
.replace(/[-_\s]+(.)?/g, (_, char: string) => {
|
||||
return char ? char.toUpperCase() : '';
|
||||
})
|
||||
.replace(/^(.)/, (firstChar) => {
|
||||
return firstChar.toLowerCase();
|
||||
});
|
||||
}
|
||||
+1
-1
@@ -61,7 +61,7 @@
|
||||
} else updateButtonDisabled = true;
|
||||
</script>
|
||||
|
||||
<Modal size="big" bind:show={showEdit} on:submit={submit} icon={option?.icon}>
|
||||
<Modal size="big" bind:show={showEdit} onSubmit={submit} icon={option?.icon}>
|
||||
<svelte:fragment slot="header">
|
||||
{attr?.type}
|
||||
{#if attr?.type === 'Relationship'}
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@
|
||||
bind:value={data.related}
|
||||
required
|
||||
placeholder="Select a collection"
|
||||
options={collectionList?.collections?.map((n) => ({ value: n.$id, label: n.name })) ?? []} />
|
||||
options={collections?.map((n) => ({ value: n.$id, label: n.name })) ?? []} />
|
||||
|
||||
{#if data?.related}
|
||||
{@const selectedCol = collections?.find((n) => n.$id === data.related)}
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
import { Button, Form, InputSelectSearch, InputText } from '$lib/elements/forms';
|
||||
import { difference } from '$lib/helpers/array';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { onMount } from 'svelte';
|
||||
import { attributes, collection } from '../store';
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
(displayNames?.length && !displayNames[displayNames?.length - 1]);
|
||||
</script>
|
||||
|
||||
<Form on:submit={updateDisplayName}>
|
||||
<Form onSubmit={updateDisplayName}>
|
||||
<CardGrid>
|
||||
<Heading tag="h6" size="7">Display Name</Heading>
|
||||
<p class="text">
|
||||
|
||||
Reference in new issue
Block a user