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