forked from themesberg/flowbite-svelte-admin-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
139 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
PUBLIC_GRAPHQL_ENDPOINT="https://graphql.dev.seekhype.io/v1/graphql" | ||
PUBLIC_API_ENDPOINT="https://ip-api.dev.aurascan.io" | ||
PUBLIC_API_ENDPOINT="https://ip-api.dev.aurascan.io" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ node_modules | |
!.env.public | ||
vite.config.js.timestamp-* | ||
vite.config.ts.timestamp-* | ||
/test-results | ||
/test-results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,4 @@ | |
border-top-right-radius: 0.5rem; | ||
object-fit: cover; | ||
} | ||
img[style*='height'] { | ||
max-height: unset; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script lang="ts"> | ||
import { Alert } from 'flowbite-svelte'; | ||
import { twMerge } from 'tailwind-merge'; | ||
const typesToColor = { | ||
info: 'blue', | ||
warning: 'yellow', | ||
success: 'green', | ||
error: 'red' | ||
}; | ||
type Type = keyof typeof typesToColor; | ||
type Color = 'blue' | 'yellow' | 'green' | 'red' | undefined; | ||
export let type: Type = 'info'; | ||
export let description: string = 'Alert description'; | ||
const color = typesToColor[type] as Color; | ||
</script> | ||
|
||
<Alert | ||
class={twMerge('fixed left-[60%] z-20 translate-x-[-50%]', $$props.class)} | ||
{color} | ||
dismissable | ||
{...$$restProps}>{description}</Alert | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,58 @@ | ||
import { updateProduct } from '$lib/apis/product/update-product.js'; | ||
import { fail, redirect } from '@sveltejs/kit'; | ||
import { invalidateAll } from '$app/navigation'; | ||
|
||
export const actions = { | ||
default: async ({ cookies, request }) => { | ||
default: async ({ params, request }) => { | ||
const id = parseInt(params.id); | ||
const data = await request.formData(); | ||
console.log(data); | ||
|
||
const requestData = { | ||
// banner_img: data.get('banner_img') as string, // TODO upload banner | ||
// avatar_img: data.get('avatar_img') as string, // TODO upload img | ||
banner_img: 'https://picsum.photos/seed/4mv5QDNfnf/640/480', | ||
avatar_img: 'https://picsum.photos/seed/4mv5QDNfnf/640/480', | ||
name: data.get('name') as string, | ||
featured: data.get('featured') === 'true', | ||
category: data.get('category') as string, | ||
collections: JSON.parse(data.get('collections') as string), | ||
description: data.get('about') as string, | ||
owner_id: parseInt(data.get('creator') as string), // TODO get users | ||
metadata: { | ||
// previews: data.get("previews"), TODO upload then use url | ||
previews: JSON.parse(data.get('previews') as string).map(() => 'http://demmo.jjj'), | ||
cta_url: data.get('cta_url') || undefined | ||
}, | ||
attributes: [ | ||
...JSON.parse(data.get('statuses') as string).map((value: string) => ({ | ||
name: 'status', | ||
value | ||
})), | ||
...JSON.parse(data.get('genres') as string).map((value: string) => ({ | ||
name: 'genre', | ||
value | ||
})), | ||
...JSON.parse(data.get('players_infos') as string).map((value: string) => ({ | ||
name: 'players info', | ||
value | ||
})), | ||
...JSON.parse(data.get('game_modes') as string).map((value: string) => ({ | ||
name: 'game mode', | ||
value | ||
})) | ||
] | ||
}; | ||
|
||
const updateResponse = await updateProduct(id, requestData); | ||
|
||
const responseData = await updateResponse.json(); | ||
|
||
console.log('responseData', responseData); // TODO remove | ||
|
||
if (updateResponse.status === 200) { | ||
throw redirect(303, `/crud/products/${id}`); // TODO force reload from server | ||
} else { | ||
return fail(responseData.statusCode, responseData); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.