mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-09 21:07:46 +00:00
chore: make method group nullable
This commit is contained in:
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@@ -35,7 +35,7 @@ importers:
|
|||||||
version: 0.26.0
|
version: 0.26.0
|
||||||
'@appwrite.io/repo':
|
'@appwrite.io/repo':
|
||||||
specifier: github:appwrite/appwrite#feat-group
|
specifier: github:appwrite/appwrite#feat-group
|
||||||
version: https://codeload.github.com/appwrite/appwrite/tar.gz/2a7038bb8ef6d8496b3012fcea4aad30625c8c08
|
version: https://codeload.github.com/appwrite/appwrite/tar.gz/c3656fd4e77d68d33b9439d1f9a0939fbfd5b5b9
|
||||||
'@eslint/compat':
|
'@eslint/compat':
|
||||||
specifier: ^1.2.7
|
specifier: ^1.2.7
|
||||||
version: 1.2.7(eslint@9.22.0(jiti@2.4.2))
|
version: 1.2.7(eslint@9.22.0(jiti@2.4.2))
|
||||||
@@ -260,8 +260,8 @@ packages:
|
|||||||
'@appwrite.io/pink@0.26.0':
|
'@appwrite.io/pink@0.26.0':
|
||||||
resolution: {integrity: sha512-iPeGE56pauzxuIXt15ZswjKCErwp3QdF3XOlJZfyYY7J2nirra85JNTL+3lWuFIf8yYWL7NbvCjhf8ig79TgwA==}
|
resolution: {integrity: sha512-iPeGE56pauzxuIXt15ZswjKCErwp3QdF3XOlJZfyYY7J2nirra85JNTL+3lWuFIf8yYWL7NbvCjhf8ig79TgwA==}
|
||||||
|
|
||||||
'@appwrite.io/repo@https://codeload.github.com/appwrite/appwrite/tar.gz/2a7038bb8ef6d8496b3012fcea4aad30625c8c08':
|
'@appwrite.io/repo@https://codeload.github.com/appwrite/appwrite/tar.gz/c3656fd4e77d68d33b9439d1f9a0939fbfd5b5b9':
|
||||||
resolution: {tarball: https://codeload.github.com/appwrite/appwrite/tar.gz/2a7038bb8ef6d8496b3012fcea4aad30625c8c08}
|
resolution: {tarball: https://codeload.github.com/appwrite/appwrite/tar.gz/c3656fd4e77d68d33b9439d1f9a0939fbfd5b5b9}
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
|
|
||||||
'@babel/runtime@7.26.10':
|
'@babel/runtime@7.26.10':
|
||||||
@@ -3931,7 +3931,7 @@ snapshots:
|
|||||||
normalize.css: 8.0.1
|
normalize.css: 8.0.1
|
||||||
the-new-css-reset: 1.11.3
|
the-new-css-reset: 1.11.3
|
||||||
|
|
||||||
'@appwrite.io/repo@https://codeload.github.com/appwrite/appwrite/tar.gz/2a7038bb8ef6d8496b3012fcea4aad30625c8c08': {}
|
'@appwrite.io/repo@https://codeload.github.com/appwrite/appwrite/tar.gz/c3656fd4e77d68d33b9439d1f9a0939fbfd5b5b9': {}
|
||||||
|
|
||||||
'@babel/runtime@7.26.10':
|
'@babel/runtime@7.26.10':
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export type SDKMethod = {
|
|||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
demo: string;
|
demo: string;
|
||||||
group: string;
|
group?: string;
|
||||||
parameters: Array<{
|
parameters: Array<{
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
@@ -35,7 +35,7 @@ type SDKMethodModel = {
|
|||||||
type AppwriteOperationObject = OpenAPIV3.OperationObject & {
|
type AppwriteOperationObject = OpenAPIV3.OperationObject & {
|
||||||
'x-appwrite': {
|
'x-appwrite': {
|
||||||
method: string;
|
method: string;
|
||||||
group: string;
|
group?: string;
|
||||||
weight: number;
|
weight: number;
|
||||||
cookies: boolean;
|
cookies: boolean;
|
||||||
type: string;
|
type: string;
|
||||||
|
|||||||
@@ -46,16 +46,13 @@
|
|||||||
selected = key;
|
selected = key;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (selectedMenuItem) {
|
if (selectedMenuItem) {
|
||||||
// First scroll the item into view
|
|
||||||
selectedMenuItem.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
selectedMenuItem.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||||
|
|
||||||
// Get the parent scrollable container (the menu)
|
|
||||||
const menuContainer = selectedMenuItem.closest(
|
const menuContainer = selectedMenuItem.closest(
|
||||||
'.web-references-menu-content'
|
'.web-references-menu-content'
|
||||||
);
|
);
|
||||||
if (menuContainer) {
|
if (menuContainer) {
|
||||||
// Add some offset to position the item higher in the viewport
|
const offset = 100; // offset to position the item higher in the viewport
|
||||||
const offset = 100; // Adjust this value as needed
|
|
||||||
menuContainer.scrollTop = menuContainer.scrollTop - offset;
|
menuContainer.scrollTop = menuContainer.scrollTop - offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +142,6 @@
|
|||||||
serviceDescription.substring(0, serviceDescription.indexOf('.') + 1)
|
serviceDescription.substring(0, serviceDescription.indexOf('.') + 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add this function to determine the operation type and its order
|
|
||||||
function getOperationOrder(methodTitle: string): number {
|
function getOperationOrder(methodTitle: string): number {
|
||||||
const title = methodTitle.toLowerCase();
|
const title = methodTitle.toLowerCase();
|
||||||
if (title.startsWith('create')) return 1;
|
if (title.startsWith('create')) return 1;
|
||||||
@@ -156,7 +152,6 @@
|
|||||||
return 5; // Other operations
|
return 5; // Other operations
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add this function to sort methods within each group
|
|
||||||
function sortMethods(methods: any[]) {
|
function sortMethods(methods: any[]) {
|
||||||
return methods.sort((a, b) => {
|
return methods.sort((a, b) => {
|
||||||
const orderA = getOperationOrder(a.title);
|
const orderA = getOperationOrder(a.title);
|
||||||
@@ -298,12 +293,14 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</section>
|
</section>
|
||||||
{#each Object.entries(data.methods.reduce((acc, method) => {
|
{#each Object.entries(data.methods.reduce((acc, method) => {
|
||||||
if (!acc[method.group]) {
|
// Group methods by their group attribute
|
||||||
acc[method.group] = [];
|
const groupKey = method.group || '';
|
||||||
|
if (!acc[groupKey]) {
|
||||||
|
acc[groupKey] = [];
|
||||||
}
|
}
|
||||||
acc[method.group].push(method);
|
acc[groupKey].push(method);
|
||||||
return acc;
|
return acc;
|
||||||
}, {})) as [_group, methods]}
|
}, {})).sort(([a], [b]) => a.localeCompare(b)) as [group, methods]}
|
||||||
{#each sortMethods(methods) as method (method.id)}
|
{#each sortMethods(methods) as method (method.id)}
|
||||||
<section class="web-article-content-grid-6-4">
|
<section class="web-article-content-grid-6-4">
|
||||||
<div class="web-article-content-grid-6-4-column-1 flex flex-col gap-8">
|
<div class="web-article-content-grid-6-4-column-1 flex flex-col gap-8">
|
||||||
@@ -392,16 +389,19 @@
|
|||||||
<ul class="web-references-menu-list">
|
<ul class="web-references-menu-list">
|
||||||
{#each Object.entries(data.methods.reduce((acc, method) => {
|
{#each Object.entries(data.methods.reduce((acc, method) => {
|
||||||
// Group methods by their group attribute
|
// Group methods by their group attribute
|
||||||
if (!acc[method.group]) {
|
const groupKey = method.group || '';
|
||||||
acc[method.group] = [];
|
if (!acc[groupKey]) {
|
||||||
|
acc[groupKey] = [];
|
||||||
}
|
}
|
||||||
acc[method.group].push(method);
|
acc[groupKey].push(method);
|
||||||
return acc;
|
return acc;
|
||||||
}, {})) as [group, methods]}
|
}, {})).sort(([a], [b]) => a.localeCompare(b)) as [group, methods]}
|
||||||
<li class="web-references-menu-group">
|
<li class="web-references-menu-group">
|
||||||
<h6 class="text-micro text-greyscale-500 mb-2 uppercase">
|
{#if group !== ''}
|
||||||
{group}
|
<h6 class="text-micro text-greyscale-500 mb-2 uppercase">
|
||||||
</h6>
|
{group}
|
||||||
|
</h6>
|
||||||
|
{/if}
|
||||||
<ul class="flex flex-col gap-2">
|
<ul class="flex flex-col gap-2">
|
||||||
{#each sortMethods(methods) as method}
|
{#each sortMethods(methods) as method}
|
||||||
<li class="web-references-menu-item">
|
<li class="web-references-menu-item">
|
||||||
|
|||||||
Reference in New Issue
Block a user