feat: items page
This commit is contained in:
296
client/src/lib/services/item/v1/item_pb.ts
Normal file
296
client/src/lib/services/item/v1/item_pb.ts
Normal file
@ -0,0 +1,296 @@
|
||||
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
|
||||
// @generated from file item/v1/item.proto (package item.v1, syntax proto3)
|
||||
/* eslint-disable */
|
||||
|
||||
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1";
|
||||
import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1";
|
||||
import type { Timestamp } from "@bufbuild/protobuf/wkt";
|
||||
import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
|
||||
import type { Message } from "@bufbuild/protobuf";
|
||||
|
||||
/**
|
||||
* Describes the file item/v1/item.proto.
|
||||
*/
|
||||
export const file_item_v1_item: GenFile = /*@__PURE__*/
|
||||
fileDesc("ChJpdGVtL3YxL2l0ZW0ucHJvdG8SB2l0ZW0udjEinAEKBEl0ZW0SDwoCaWQYASABKA1IAIgBARIMCgRuYW1lGAIgASgJEhMKC2Rlc2NyaXB0aW9uGAMgASgJEg0KBXByaWNlGAQgASgCEhAKCHF1YW50aXR5GAUgASgNEi4KBWFkZGVkGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEgBiAEBQgUKA19pZEIICgZfYWRkZWQiHAoOR2V0SXRlbVJlcXVlc3QSCgoCaWQYASABKA0iLgoPR2V0SXRlbVJlc3BvbnNlEhsKBGl0ZW0YASABKAsyDS5pdGVtLnYxLkl0ZW0i3wEKD0dldEl0ZW1zUmVxdWVzdBIuCgVzdGFydBgBIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBIAIgBARIsCgNlbmQYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wSAGIAQESEwoGZmlsdGVyGAMgASgJSAKIAQESEgoFbGltaXQYBCABKA1IA4gBARITCgZvZmZzZXQYBSABKA1IBIgBAUIICgZfc3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mV2c3RhY2svc2VydmVyL2ludGVybmFsL3NlcnZpY2VzL2l0ZW0vdjE7aXRlbXYxogIDSVhYqgIHSXRlbS5WMcoCB0l0ZW1cVjHiAhNJdGVtXFYxXEdQQk1ldGFkYXRh6gIISXRlbTo6VjFiBnByb3RvMw", [file_google_protobuf_timestamp]);
|
||||
|
||||
/**
|
||||
* @generated from message item.v1.Item
|
||||
*/
|
||||
export type Item = Message<"item.v1.Item"> & {
|
||||
/**
|
||||
* @generated from field: optional uint32 id = 1;
|
||||
*/
|
||||
id?: number;
|
||||
|
||||
/**
|
||||
* @generated from field: string name = 2;
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* @generated from field: string description = 3;
|
||||
*/
|
||||
description: string;
|
||||
|
||||
/**
|
||||
* @generated from field: float price = 4;
|
||||
*/
|
||||
price: number;
|
||||
|
||||
/**
|
||||
* @generated from field: uint32 quantity = 5;
|
||||
*/
|
||||
quantity: number;
|
||||
|
||||
/**
|
||||
* @generated from field: optional google.protobuf.Timestamp added = 6;
|
||||
*/
|
||||
added?: Timestamp;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the message item.v1.Item.
|
||||
* Use `create(ItemSchema)` to create a new message.
|
||||
*/
|
||||
export const ItemSchema: GenMessage<Item> = /*@__PURE__*/
|
||||
messageDesc(file_item_v1_item, 0);
|
||||
|
||||
/**
|
||||
* @generated from message item.v1.GetItemRequest
|
||||
*/
|
||||
export type GetItemRequest = Message<"item.v1.GetItemRequest"> & {
|
||||
/**
|
||||
* @generated from field: uint32 id = 1;
|
||||
*/
|
||||
id: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the message item.v1.GetItemRequest.
|
||||
* Use `create(GetItemRequestSchema)` to create a new message.
|
||||
*/
|
||||
export const GetItemRequestSchema: GenMessage<GetItemRequest> = /*@__PURE__*/
|
||||
messageDesc(file_item_v1_item, 1);
|
||||
|
||||
/**
|
||||
* @generated from message item.v1.GetItemResponse
|
||||
*/
|
||||
export type GetItemResponse = Message<"item.v1.GetItemResponse"> & {
|
||||
/**
|
||||
* @generated from field: item.v1.Item item = 1;
|
||||
*/
|
||||
item?: Item;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the message item.v1.GetItemResponse.
|
||||
* Use `create(GetItemResponseSchema)` to create a new message.
|
||||
*/
|
||||
export const GetItemResponseSchema: GenMessage<GetItemResponse> = /*@__PURE__*/
|
||||
messageDesc(file_item_v1_item, 2);
|
||||
|
||||
/**
|
||||
* @generated from message item.v1.GetItemsRequest
|
||||
*/
|
||||
export type GetItemsRequest = Message<"item.v1.GetItemsRequest"> & {
|
||||
/**
|
||||
* @generated from field: optional google.protobuf.Timestamp start = 1;
|
||||
*/
|
||||
start?: Timestamp;
|
||||
|
||||
/**
|
||||
* @generated from field: optional google.protobuf.Timestamp end = 2;
|
||||
*/
|
||||
end?: Timestamp;
|
||||
|
||||
/**
|
||||
* @generated from field: optional string filter = 3;
|
||||
*/
|
||||
filter?: string;
|
||||
|
||||
/**
|
||||
* @generated from field: optional uint32 limit = 4;
|
||||
*/
|
||||
limit?: number;
|
||||
|
||||
/**
|
||||
* @generated from field: optional uint32 offset = 5;
|
||||
*/
|
||||
offset?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the message item.v1.GetItemsRequest.
|
||||
* Use `create(GetItemsRequestSchema)` to create a new message.
|
||||
*/
|
||||
export const GetItemsRequestSchema: GenMessage<GetItemsRequest> = /*@__PURE__*/
|
||||
messageDesc(file_item_v1_item, 3);
|
||||
|
||||
/**
|
||||
* @generated from message item.v1.GetItemsResponse
|
||||
*/
|
||||
export type GetItemsResponse = Message<"item.v1.GetItemsResponse"> & {
|
||||
/**
|
||||
* @generated from field: repeated item.v1.Item items = 1;
|
||||
*/
|
||||
items: Item[];
|
||||
|
||||
/**
|
||||
* @generated from field: uint64 count = 2;
|
||||
*/
|
||||
count: bigint;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the message item.v1.GetItemsResponse.
|
||||
* Use `create(GetItemsResponseSchema)` to create a new message.
|
||||
*/
|
||||
export const GetItemsResponseSchema: GenMessage<GetItemsResponse> = /*@__PURE__*/
|
||||
messageDesc(file_item_v1_item, 4);
|
||||
|
||||
/**
|
||||
* @generated from message item.v1.CreateItemRequest
|
||||
*/
|
||||
export type CreateItemRequest = Message<"item.v1.CreateItemRequest"> & {
|
||||
/**
|
||||
* @generated from field: item.v1.Item item = 1;
|
||||
*/
|
||||
item?: Item;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the message item.v1.CreateItemRequest.
|
||||
* Use `create(CreateItemRequestSchema)` to create a new message.
|
||||
*/
|
||||
export const CreateItemRequestSchema: GenMessage<CreateItemRequest> = /*@__PURE__*/
|
||||
messageDesc(file_item_v1_item, 5);
|
||||
|
||||
/**
|
||||
* @generated from message item.v1.CreateItemResponse
|
||||
*/
|
||||
export type CreateItemResponse = Message<"item.v1.CreateItemResponse"> & {
|
||||
/**
|
||||
* @generated from field: item.v1.Item item = 1;
|
||||
*/
|
||||
item?: Item;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the message item.v1.CreateItemResponse.
|
||||
* Use `create(CreateItemResponseSchema)` to create a new message.
|
||||
*/
|
||||
export const CreateItemResponseSchema: GenMessage<CreateItemResponse> = /*@__PURE__*/
|
||||
messageDesc(file_item_v1_item, 6);
|
||||
|
||||
/**
|
||||
* @generated from message item.v1.UpdateItemRequest
|
||||
*/
|
||||
export type UpdateItemRequest = Message<"item.v1.UpdateItemRequest"> & {
|
||||
/**
|
||||
* @generated from field: item.v1.Item item = 1;
|
||||
*/
|
||||
item?: Item;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the message item.v1.UpdateItemRequest.
|
||||
* Use `create(UpdateItemRequestSchema)` to create a new message.
|
||||
*/
|
||||
export const UpdateItemRequestSchema: GenMessage<UpdateItemRequest> = /*@__PURE__*/
|
||||
messageDesc(file_item_v1_item, 7);
|
||||
|
||||
/**
|
||||
* @generated from message item.v1.UpdateItemResponse
|
||||
*/
|
||||
export type UpdateItemResponse = Message<"item.v1.UpdateItemResponse"> & {
|
||||
/**
|
||||
* @generated from field: item.v1.Item item = 1;
|
||||
*/
|
||||
item?: Item;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the message item.v1.UpdateItemResponse.
|
||||
* Use `create(UpdateItemResponseSchema)` to create a new message.
|
||||
*/
|
||||
export const UpdateItemResponseSchema: GenMessage<UpdateItemResponse> = /*@__PURE__*/
|
||||
messageDesc(file_item_v1_item, 8);
|
||||
|
||||
/**
|
||||
* @generated from message item.v1.DeleteItemRequest
|
||||
*/
|
||||
export type DeleteItemRequest = Message<"item.v1.DeleteItemRequest"> & {
|
||||
/**
|
||||
* @generated from field: uint32 id = 1;
|
||||
*/
|
||||
id: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the message item.v1.DeleteItemRequest.
|
||||
* Use `create(DeleteItemRequestSchema)` to create a new message.
|
||||
*/
|
||||
export const DeleteItemRequestSchema: GenMessage<DeleteItemRequest> = /*@__PURE__*/
|
||||
messageDesc(file_item_v1_item, 9);
|
||||
|
||||
/**
|
||||
* @generated from message item.v1.DeleteItemResponse
|
||||
*/
|
||||
export type DeleteItemResponse = Message<"item.v1.DeleteItemResponse"> & {
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the message item.v1.DeleteItemResponse.
|
||||
* Use `create(DeleteItemResponseSchema)` to create a new message.
|
||||
*/
|
||||
export const DeleteItemResponseSchema: GenMessage<DeleteItemResponse> = /*@__PURE__*/
|
||||
messageDesc(file_item_v1_item, 10);
|
||||
|
||||
/**
|
||||
* @generated from service item.v1.ItemService
|
||||
*/
|
||||
export const ItemService: GenService<{
|
||||
/**
|
||||
* @generated from rpc item.v1.ItemService.GetItem
|
||||
*/
|
||||
getItem: {
|
||||
methodKind: "unary";
|
||||
input: typeof GetItemRequestSchema;
|
||||
output: typeof GetItemResponseSchema;
|
||||
},
|
||||
/**
|
||||
* @generated from rpc item.v1.ItemService.GetItems
|
||||
*/
|
||||
getItems: {
|
||||
methodKind: "unary";
|
||||
input: typeof GetItemsRequestSchema;
|
||||
output: typeof GetItemsResponseSchema;
|
||||
},
|
||||
/**
|
||||
* @generated from rpc item.v1.ItemService.CreateItem
|
||||
*/
|
||||
createItem: {
|
||||
methodKind: "unary";
|
||||
input: typeof CreateItemRequestSchema;
|
||||
output: typeof CreateItemResponseSchema;
|
||||
},
|
||||
/**
|
||||
* @generated from rpc item.v1.ItemService.UpdateItem
|
||||
*/
|
||||
updateItem: {
|
||||
methodKind: "unary";
|
||||
input: typeof UpdateItemRequestSchema;
|
||||
output: typeof UpdateItemResponseSchema;
|
||||
},
|
||||
/**
|
||||
* @generated from rpc item.v1.ItemService.DeleteItem
|
||||
*/
|
||||
deleteItem: {
|
||||
methodKind: "unary";
|
||||
input: typeof DeleteItemRequestSchema;
|
||||
output: typeof DeleteItemResponseSchema;
|
||||
},
|
||||
}> = /*@__PURE__*/
|
||||
serviceDesc(file_item_v1_item, 0);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { createConnectTransport } from "@connectrpc/connect-web"
|
||||
import { Code, ConnectError, createClient } from "@connectrpc/connect"
|
||||
import { Code, ConnectError, createClient, type Interceptor } from "@connectrpc/connect"
|
||||
import { AuthService } from "$lib/services/user/v1/auth_pb";
|
||||
import { UserService } from "$lib/services/user/v1/user_pb";
|
||||
import type { Interceptor } from "@connectrpc/connect";
|
||||
import { ItemService } from "$lib/services/item/v1/item_pb";
|
||||
import { goto } from "$app/navigation";
|
||||
|
||||
const redirector: Interceptor = (next) => async (req) => {
|
||||
@ -23,4 +23,5 @@ const transport = createConnectTransport({
|
||||
});
|
||||
|
||||
export const AuthClient = createClient(AuthService, transport);
|
||||
export const UserClient = createClient(UserService, transport);
|
||||
export const UserClient = createClient(UserService, transport);
|
||||
export const ItemClient = createClient(ItemService, transport);
|
51
client/src/lib/ui/Modal.svelte
Normal file
51
client/src/lib/ui/Modal.svelte
Normal file
@ -0,0 +1,51 @@
|
||||
<script lang="ts">
|
||||
import { Dialog } from 'bits-ui';
|
||||
import { fade } from 'svelte/transition';
|
||||
import type { Snippet } from 'svelte';
|
||||
|
||||
let {
|
||||
trigger,
|
||||
content,
|
||||
open = $bindable(false)
|
||||
}: { trigger: Snippet; content: Snippet; open: boolean } = $props();
|
||||
</script>
|
||||
|
||||
<Dialog.Root bind:open>
|
||||
<Dialog.Trigger>
|
||||
{@render trigger()}
|
||||
</Dialog.Trigger>
|
||||
<Dialog.Portal>
|
||||
<Dialog.Overlay forceMount>
|
||||
{#snippet child({ props, open })}
|
||||
{#if open}
|
||||
<div
|
||||
{...props}
|
||||
transition:fade={{
|
||||
duration: 100
|
||||
}}
|
||||
>
|
||||
<div class="fixed inset-0 z-50 mt-[50px] bg-black/50 transition-all"></div>
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
</Dialog.Overlay>
|
||||
<Dialog.Content forceMount>
|
||||
{#snippet child({ props, open })}
|
||||
{#if open}
|
||||
<div
|
||||
{...props}
|
||||
transition:fade={{
|
||||
duration: 100
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="bg-mantle border-surface-0 fixed inset-0 left-[50%] top-[50%] z-50 size-fit w-96 -translate-x-1/2 -translate-y-1/2 transform overflow-y-auto rounded-xl border pb-1 drop-shadow-md"
|
||||
>
|
||||
{@render content()}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
</Dialog.Content>
|
||||
</Dialog.Portal>
|
||||
</Dialog.Root>
|
Reference in New Issue
Block a user