Refactor environment variable declarations, enhance image handling in item forms, and update asset references in SvelteKit project for improved functionality and performance.
This commit is contained in:
@@ -117,7 +117,7 @@
|
||||
"_index.js"
|
||||
],
|
||||
"css": [
|
||||
"_app/immutable/assets/_layout.BN8lb0qC.css"
|
||||
"_app/immutable/assets/_layout.BQZUYDmN.css"
|
||||
]
|
||||
},
|
||||
"src/routes/+layout.ts": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1106,39 +1106,40 @@ function ensure_array_like(array_like_or_iterator) {
|
||||
return [];
|
||||
}
|
||||
export {
|
||||
array_from as $,
|
||||
ASYNC as A,
|
||||
define_property as $,
|
||||
DESTROYED as A,
|
||||
BOUNDARY_EFFECT as B,
|
||||
COMMENT_NODE as C,
|
||||
DIRTY as D,
|
||||
ERROR_VALUE as E,
|
||||
includes as F,
|
||||
EFFECT_TRANSPARENT as G,
|
||||
ASYNC as F,
|
||||
includes as G,
|
||||
HYDRATION_ERROR as H,
|
||||
INERT as I,
|
||||
EFFECT_PRESERVED as J,
|
||||
EAGER_EFFECT as K,
|
||||
STATE_SYMBOL as L,
|
||||
EFFECT_TRANSPARENT as J,
|
||||
EFFECT_PRESERVED as K,
|
||||
EAGER_EFFECT as L,
|
||||
MAYBE_DIRTY as M,
|
||||
object_prototype as N,
|
||||
array_prototype as O,
|
||||
get_descriptor as P,
|
||||
get_prototype_of as Q,
|
||||
STATE_SYMBOL as N,
|
||||
object_prototype as O,
|
||||
array_prototype as P,
|
||||
get_descriptor as Q,
|
||||
REACTION_RAN as R,
|
||||
STALE_REACTION as S,
|
||||
is_array as T,
|
||||
get_prototype_of as T,
|
||||
UNINITIALIZED as U,
|
||||
is_extensible as V,
|
||||
is_array as V,
|
||||
WAS_MARKED as W,
|
||||
USER_EFFECT as X,
|
||||
REACTION_IS_UPDATING as Y,
|
||||
index_of as Z,
|
||||
define_property as _,
|
||||
is_extensible as X,
|
||||
USER_EFFECT as Y,
|
||||
REACTION_IS_UPDATING as Z,
|
||||
index_of as _,
|
||||
attributes as a,
|
||||
is_passive_event as a0,
|
||||
LEGACY_PROPS as a1,
|
||||
render as a2,
|
||||
setContext as a3,
|
||||
array_from as a0,
|
||||
is_passive_event as a1,
|
||||
LEGACY_PROPS as a2,
|
||||
render as a3,
|
||||
setContext as a4,
|
||||
bind_props as b,
|
||||
clsx as c,
|
||||
element as d,
|
||||
@@ -1146,22 +1147,22 @@ export {
|
||||
ensure_array_like as f,
|
||||
getContext as g,
|
||||
head as h,
|
||||
HYDRATION_END as i,
|
||||
HYDRATION_START as j,
|
||||
HYDRATION_START_ELSE as k,
|
||||
EFFECT as l,
|
||||
CONNECTED as m,
|
||||
attr as i,
|
||||
HYDRATION_END as j,
|
||||
HYDRATION_START as k,
|
||||
HYDRATION_START_ELSE as l,
|
||||
EFFECT as m,
|
||||
noop as n,
|
||||
CLEAN as o,
|
||||
DERIVED as p,
|
||||
BLOCK_EFFECT as q,
|
||||
CONNECTED as o,
|
||||
CLEAN as p,
|
||||
DERIVED as q,
|
||||
run_all as r,
|
||||
slot as s,
|
||||
deferred as t,
|
||||
BRANCH_EFFECT as u,
|
||||
ROOT_EFFECT as v,
|
||||
RENDER_EFFECT as w,
|
||||
MANAGED_EFFECT as x,
|
||||
HEAD_EFFECT as y,
|
||||
DESTROYED as z
|
||||
BLOCK_EFFECT as t,
|
||||
deferred as u,
|
||||
BRANCH_EFFECT as v,
|
||||
ROOT_EFFECT as w,
|
||||
RENDER_EFFECT as x,
|
||||
MANAGED_EFFECT as y,
|
||||
HEAD_EFFECT as z
|
||||
};
|
||||
|
||||
@@ -101,7 +101,7 @@ const options = {
|
||||
<div class="error">
|
||||
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
|
||||
},
|
||||
version_hash: "5hw1yq"
|
||||
version_hash: "1clozn7"
|
||||
};
|
||||
async function get_hooks() {
|
||||
let handle;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { H as HYDRATION_ERROR, C as COMMENT_NODE, i as HYDRATION_END, j as HYDRATION_START, k as HYDRATION_START_ELSE, r as run_all, B as BOUNDARY_EFFECT, R as REACTION_RAN, E as ERROR_VALUE, l as EFFECT, m as CONNECTED, o as CLEAN, M as MAYBE_DIRTY, D as DIRTY, p as DERIVED, W as WAS_MARKED, I as INERT, q as BLOCK_EFFECT, U as UNINITIALIZED, t as deferred, u as BRANCH_EFFECT, v as ROOT_EFFECT, w as RENDER_EFFECT, x as MANAGED_EFFECT, y as HEAD_EFFECT, z as DESTROYED, A as ASYNC, F as includes, G as EFFECT_TRANSPARENT, J as EFFECT_PRESERVED, S as STALE_REACTION, n as noop, K as EAGER_EFFECT, L as STATE_SYMBOL, N as object_prototype, O as array_prototype, P as get_descriptor, Q as get_prototype_of, T as is_array, V as is_extensible, X as USER_EFFECT, Y as REACTION_IS_UPDATING, Z as index_of, _ as define_property, $ as array_from, a0 as is_passive_event, a1 as LEGACY_PROPS, a2 as render, a3 as setContext } from "./index.js";
|
||||
import { H as HYDRATION_ERROR, C as COMMENT_NODE, j as HYDRATION_END, k as HYDRATION_START, l as HYDRATION_START_ELSE, r as run_all, B as BOUNDARY_EFFECT, R as REACTION_RAN, E as ERROR_VALUE, m as EFFECT, o as CONNECTED, p as CLEAN, M as MAYBE_DIRTY, D as DIRTY, q as DERIVED, W as WAS_MARKED, I as INERT, t as BLOCK_EFFECT, U as UNINITIALIZED, u as deferred, v as BRANCH_EFFECT, w as ROOT_EFFECT, x as RENDER_EFFECT, y as MANAGED_EFFECT, z as HEAD_EFFECT, A as DESTROYED, F as ASYNC, G as includes, J as EFFECT_TRANSPARENT, K as EFFECT_PRESERVED, S as STALE_REACTION, n as noop, L as EAGER_EFFECT, N as STATE_SYMBOL, O as object_prototype, P as array_prototype, Q as get_descriptor, T as get_prototype_of, V as is_array, X as is_extensible, Y as USER_EFFECT, Z as REACTION_IS_UPDATING, _ as index_of, $ as define_property, a0 as array_from, a1 as is_passive_event, a2 as LEGACY_PROPS, a3 as render, a4 as setContext } from "./index.js";
|
||||
import { D as DEV } from "./false.js";
|
||||
import "clsx";
|
||||
function equals(value) {
|
||||
|
||||
@@ -33,9 +33,11 @@ const actions = {
|
||||
const Has_Parent = parseBool(form.get("Has_Parent"));
|
||||
const Parent = form.get("Parent")?.trim() ?? "";
|
||||
const Stock = parseBool(form.get("Stock"));
|
||||
const imageFileCreate = form.get("Image");
|
||||
const hasImage = imageFileCreate && imageFileCreate.size > 0;
|
||||
if (!Item) return fail(400, { error: "Item name is required", form: "create" });
|
||||
try {
|
||||
await locals.pb.collection(COLLECTION).create({
|
||||
const body = {
|
||||
Item,
|
||||
SKU,
|
||||
Description,
|
||||
@@ -47,7 +49,9 @@ const actions = {
|
||||
Has_Parent: !!Has_Parent,
|
||||
Parent: Parent || null,
|
||||
Stock: !!Stock
|
||||
});
|
||||
};
|
||||
if (hasImage) body.Image = imageFileCreate;
|
||||
await locals.pb.collection(COLLECTION).create(body);
|
||||
} catch (e) {
|
||||
const message = e && typeof e === "object" && "message" in e ? String(e.message) : "Create failed";
|
||||
return fail(500, { error: message, form: "create" });
|
||||
@@ -69,9 +73,11 @@ const actions = {
|
||||
const Has_Parent = parseBool(form.get("Has_Parent"));
|
||||
const Parent = form.get("Parent")?.trim() ?? "";
|
||||
const Stock = parseBool(form.get("Stock"));
|
||||
const Image = form.get("Image");
|
||||
const imageFile = Image && Image.size > 0 ? Image : void 0;
|
||||
if (!Item) return fail(400, { error: "Item name is required", form: "update" });
|
||||
try {
|
||||
await locals.pb.collection(COLLECTION).update(id, {
|
||||
const body = {
|
||||
Item,
|
||||
SKU,
|
||||
Description,
|
||||
@@ -83,7 +89,9 @@ const actions = {
|
||||
Has_Parent: !!Has_Parent,
|
||||
Parent: Parent || null,
|
||||
Stock: !!Stock
|
||||
});
|
||||
};
|
||||
if (imageFile) body.Image = imageFile;
|
||||
await locals.pb.collection(COLLECTION).update(id, body);
|
||||
} catch (e) {
|
||||
const message = e && typeof e === "object" && "message" in e ? String(e.message) : "Update failed";
|
||||
return fail(500, { error: message, form: "update" });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { a as attributes, c as clsx, b as bind_props, d as element, h as head, e as escape_html, f as ensure_array_like } from "../../../chunks/index.js";
|
||||
import { a as attributes, c as clsx, b as bind_props, d as element, h as head, e as escape_html, f as ensure_array_like, i as attr } from "../../../chunks/index.js";
|
||||
import { c as cn } from "../../../chunks/utils2.js";
|
||||
import "clsx";
|
||||
import { tv } from "tailwind-variants";
|
||||
@@ -221,6 +221,12 @@ function _page($$renderer, $$props) {
|
||||
}
|
||||
}
|
||||
const items = data?.items ?? [];
|
||||
const PB_BASE = "https://pocketbase.ccllc.pro";
|
||||
const COLLECTION = "Stackq_Items";
|
||||
function imageUrl(item) {
|
||||
if (!item.Image) return null;
|
||||
return `${PB_BASE}/api/files/${COLLECTION}/${item.id}/${item.Image}`;
|
||||
}
|
||||
head("rk8na7", $$renderer2, ($$renderer3) => {
|
||||
$$renderer3.title(($$renderer4) => {
|
||||
$$renderer4.push(`<title>Items – Stackq</title>`);
|
||||
@@ -243,6 +249,14 @@ function _page($$renderer, $$props) {
|
||||
$$renderer6.push("<!---->");
|
||||
Table_row?.($$renderer6, {
|
||||
children: ($$renderer7) => {
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Image`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
@@ -369,7 +383,7 @@ function _page($$renderer, $$props) {
|
||||
children: ($$renderer7) => {
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
colspan: "13",
|
||||
colspan: "14",
|
||||
class: "h-24 text-center text-muted-foreground",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->No items.`);
|
||||
@@ -390,6 +404,22 @@ function _page($$renderer, $$props) {
|
||||
$$renderer6.push("<!---->");
|
||||
Table_row?.($$renderer6, {
|
||||
children: ($$renderer7) => {
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "w-16",
|
||||
children: ($$renderer8) => {
|
||||
if (imageUrl(item)) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
$$renderer8.push(`<img${attr("src", imageUrl(item))} alt="" class="size-14 rounded border object-cover" loading="lazy"/>`);
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
$$renderer8.push(`<span class="text-muted-foreground text-xs">—</span>`);
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "font-medium",
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import "./chunks/root.js";
|
||||
import { s, a, b } from "./chunks/environment.js";
|
||||
import { g, o, c, s as s2, a as a2, b as b2 } from "./chunks/internal.js";
|
||||
export {
|
||||
g as get_hooks,
|
||||
o as options,
|
||||
s as set_assets,
|
||||
a as set_building,
|
||||
c as set_manifest,
|
||||
b as set_prerendering,
|
||||
s2 as set_private_env,
|
||||
a2 as set_public_env,
|
||||
b2 as set_read_implementation
|
||||
};
|
||||
@@ -10,7 +10,7 @@ return {
|
||||
assets: new Set([]),
|
||||
mimeTypes: {},
|
||||
_: {
|
||||
client: {start:"_app/immutable/entry/start.C2MVIkwD.js",app:"_app/immutable/entry/app.BsFk1HrO.js",imports:["_app/immutable/entry/start.C2MVIkwD.js","_app/immutable/chunks/BXb9cfiV.js","_app/immutable/chunks/BMmwim-G.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/entry/app.BsFk1HrO.js","_app/immutable/chunks/DPCugUAM.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/D6Mj8HfB.js","_app/immutable/chunks/BMmwim-G.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/znVx7SEM.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
client: {start:"_app/immutable/entry/start.lYj2oyFl.js",app:"_app/immutable/entry/app.xKzg9ha8.js",imports:["_app/immutable/entry/start.lYj2oyFl.js","_app/immutable/chunks/BU_acMKx.js","_app/immutable/chunks/BMmwim-G.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/entry/app.xKzg9ha8.js","_app/immutable/chunks/DPCugUAM.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/D6Mj8HfB.js","_app/immutable/chunks/BMmwim-G.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/znVx7SEM.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
nodes: [
|
||||
__memo(() => import('./nodes/0.js')),
|
||||
__memo(() => import('./nodes/1.js')),
|
||||
|
||||
@@ -10,7 +10,7 @@ return {
|
||||
assets: new Set([]),
|
||||
mimeTypes: {},
|
||||
_: {
|
||||
client: {start:"_app/immutable/entry/start.C2MVIkwD.js",app:"_app/immutable/entry/app.BsFk1HrO.js",imports:["_app/immutable/entry/start.C2MVIkwD.js","_app/immutable/chunks/BXb9cfiV.js","_app/immutable/chunks/BMmwim-G.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/entry/app.BsFk1HrO.js","_app/immutable/chunks/DPCugUAM.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/D6Mj8HfB.js","_app/immutable/chunks/BMmwim-G.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/znVx7SEM.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
client: {start:"_app/immutable/entry/start.lYj2oyFl.js",app:"_app/immutable/entry/app.xKzg9ha8.js",imports:["_app/immutable/entry/start.lYj2oyFl.js","_app/immutable/chunks/BU_acMKx.js","_app/immutable/chunks/BMmwim-G.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/entry/app.xKzg9ha8.js","_app/immutable/chunks/DPCugUAM.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/D6Mj8HfB.js","_app/immutable/chunks/BMmwim-G.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/znVx7SEM.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
nodes: [
|
||||
__memo(() => import('./nodes/0.js')),
|
||||
__memo(() => import('./nodes/1.js')),
|
||||
|
||||
@@ -5,6 +5,6 @@ let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/_layout.svelte.js')).default;
|
||||
export { universal };
|
||||
export const universal_id = "src/routes/+layout.ts";
|
||||
export const imports = ["_app/immutable/nodes/0.DZETcxWC.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/DAt58MA1.js","_app/immutable/chunks/MIlO0V30.js"];
|
||||
export const stylesheets = ["_app/immutable/assets/0.BgdOWdGt.css"];
|
||||
export const imports = ["_app/immutable/nodes/0.BbNusdVr.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/DAt58MA1.js","_app/immutable/chunks/MIlO0V30.js"];
|
||||
export const stylesheets = ["_app/immutable/assets/0.EFPCDS6k.css"];
|
||||
export const fonts = [];
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
export const index = 1;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/fallbacks/error.svelte.js')).default;
|
||||
export const imports = ["_app/immutable/nodes/1.DMG02OYc.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/DAt58MA1.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/BMmwim-G.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/chunks/BXb9cfiV.js"];
|
||||
export const imports = ["_app/immutable/nodes/1.BSDMq5ii.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/DAt58MA1.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/BMmwim-G.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/chunks/BU_acMKx.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
|
||||
@@ -5,6 +5,6 @@ let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/items/_page.svelte.js')).default;
|
||||
export { server };
|
||||
export const server_id = "src/routes/items/+page.server.ts";
|
||||
export const imports = ["_app/immutable/nodes/4.BhfvMQ1L.js","_app/immutable/chunks/hxRy_pid.js","_app/immutable/chunks/DPCugUAM.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/D6Mj8HfB.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/DBvDeCtH.js","_app/immutable/chunks/De4R2cbq.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/chunks/znVx7SEM.js"];
|
||||
export const imports = ["_app/immutable/nodes/4.CiQuz_-G.js","_app/immutable/chunks/D1I5yNUo.js","_app/immutable/chunks/DPCugUAM.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/D6Mj8HfB.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/DBvDeCtH.js","_app/immutable/chunks/De4R2cbq.js","_app/immutable/chunks/Dt2zEVER.js","_app/immutable/chunks/znVx7SEM.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
|
||||
@@ -5,6 +5,6 @@ let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/login/_page.svelte.js')).default;
|
||||
export { server };
|
||||
export const server_id = "src/routes/login/+page.server.ts";
|
||||
export const imports = ["_app/immutable/nodes/5.Cf_DU5yu.js","_app/immutable/chunks/DPCugUAM.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/D6Mj8HfB.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/DBvDeCtH.js"];
|
||||
export const imports = ["_app/immutable/nodes/5.CncCf1V5.js","_app/immutable/chunks/DPCugUAM.js","_app/immutable/chunks/MIlO0V30.js","_app/immutable/chunks/D6Mj8HfB.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/DBvDeCtH.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
|
||||
Reference in New Issue
Block a user