Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

BaseAsset > Asset

Oleg Isonen228a269b3951
diff --git a/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-info-tigger.tsx b/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-info-tigger.tsx
index 090d9ff201..eb8c285963 100644
--- a/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-info-tigger.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-info-tigger.tsx
@@ -8,10 +8,9 @@ import {
PopoverHeader,
} from "@webstudio-is/design-system";
import { GearIcon, gearIconCssVars } from "@webstudio-is/icons";
-
import { AssetInfo } from "./asset-info";
import { cssVars } from "@webstudio-is/css-vars";
-import { BaseAsset } from "~/designer/shared/assets";
+import { Asset } from "@webstudio-is/asset-uploader";
const triggerVisibilityVar = cssVars.define("trigger-visibility");
@@ -23,7 +22,7 @@ export const AssetInfoTrigger = ({
asset,
onDelete,
}: {
- asset: BaseAsset;
+ asset: Asset;
onDelete: () => void;
}) => {
const [isInfoOpen, setInfoOpen] = useState(false);
diff --git a/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-info.tsx b/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-info.tsx
index 659179607c..491709c4a4 100644
--- a/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-info.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-info.tsx
@@ -8,7 +8,7 @@ import {
} from "@webstudio-is/icons";
import { useSubmit } from "@remix-run/react";
import prettyBytes from "pretty-bytes";
-import type { BaseAsset } from "~/designer/shared/assets";
+import { Asset } from "@webstudio-is/asset-uploader";
const Filename = ({ name }: { name: string }) => {
const splitName = name.split(".");
@@ -45,7 +45,7 @@ const Filename = ({ name }: { name: string }) => {
);
};
-type AssetInfoProps = BaseAsset & {
+type AssetInfoProps = Asset & {
onClose: () => void;
onDelete: () => void;
};
diff --git a/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-thumbnail.tsx b/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-thumbnail.tsx
index e712f1890a..19b95ba005 100644
--- a/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-thumbnail.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/panels/assets/asset-thumbnail.tsx
@@ -4,7 +4,8 @@ import placeholderImage from "~/shared/images/image-placeholder.svg";
import brokenImage from "~/shared/images/broken-image-placeholder.svg";
import { UploadingAnimation } from "./uploading-animation";
import { AssetInfoTrigger, assetInfoTriggerCssVars } from "./asset-info-tigger";
-import type { BaseAsset, PreviewAsset } from "~/designer/shared/assets";
+import type { PreviewAsset } from "~/designer/shared/assets";
+import { Asset } from "@webstudio-is/asset-uploader";
const useImageWithFallback = ({
path = placeholderImage,
@@ -25,7 +26,7 @@ const useImageWithFallback = ({
type ThumbnailProps = {
path?: string;
- status: BaseAsset["status"];
+ status: Asset["status"];
};
export const Thumbnail = ({ path, status }: ThumbnailProps) => {
@@ -51,7 +52,7 @@ export const Thumbnail = ({ path, status }: ThumbnailProps) => {
);
};
-export const AssetThumbnail = (asset: BaseAsset | PreviewAsset) => {
+export const AssetThumbnail = (asset: Asset | PreviewAsset) => {
const { path, status, name } = asset;
const description =
"description" in asset && asset.description ? asset.description : name;
diff --git a/apps/designer/app/designer/shared/assets/types.ts b/apps/designer/app/designer/shared/assets/types.ts
index 18f654dddd..e8c18f403f 100644
--- a/apps/designer/app/designer/shared/assets/types.ts
+++ b/apps/designer/app/designer/shared/assets/types.ts
@@ -1,12 +1,7 @@
import { Asset } from "@webstudio-is/asset-uploader";
-export type BaseAsset = Pick<
- Asset,
- "id" | "status" | "name" | "path" | "description" | "size" | "meta" | "format"
->;
-
export type PreviewAsset = Pick<
- BaseAsset,
+ Asset,
"path" | "name" | "id" | "status" | "format"
>;
diff --git a/apps/designer/app/designer/shared/assets/use-assets.ts b/apps/designer/app/designer/shared/assets/use-assets.ts
index a7318e0aae..c9f746836d 100644
--- a/apps/designer/app/designer/shared/assets/use-assets.ts
+++ b/apps/designer/app/designer/shared/assets/use-assets.ts
@@ -1,7 +1,11 @@
import { useMemo, useState } from "react";
import { useActionData } from "@remix-run/react";
-import type { BaseAsset, PreviewAsset, ActionData } from "./types";
-import { type AssetType, filterByType } from "@webstudio-is/asset-uploader";
+import type { PreviewAsset, ActionData } from "./types";
+import {
+ type AssetType,
+ type Asset,
+ filterByType,
+} from "@webstudio-is/asset-uploader";
import { useAssets as useAllAssets } from "../nano-states";
export const useAssets = (type: AssetType) => {
@@ -13,7 +17,7 @@ export const useAssets = (type: AssetType) => {
const assets = useMemo(() => {
const { errors, uploadedAssets = [], deletedAsset } = actionData ?? {};
- let assets: Array<BaseAsset | PreviewAsset> = [];
+ let assets: Array<Asset | PreviewAsset> = [];
// Once we have uploaded or deleted assets in action data, current upload was finished.
if (
diff --git a/apps/designer/app/designer/shared/nano-states/index.ts b/apps/designer/app/designer/shared/nano-states/index.ts
index c53b0eb309..667f42f760 100644
--- a/apps/designer/app/designer/shared/nano-states/index.ts
+++ b/apps/designer/app/designer/shared/nano-states/index.ts
@@ -5,7 +5,7 @@ import {
type HoveredInstanceData,
} from "~/shared/canvas-components";
import { type SyncStatus } from "~/shared/sync";
-import { BaseAsset } from "../assets";
+import { Asset } from "@webstudio-is/asset-uploader";
const selectedInstanceDataContainer = createValueContainer<
SelectedInstanceData | undefined
@@ -47,5 +47,5 @@ export const useSyncStatus = () => useValue(syncStatusContainer);
const selectionRectContainer = createValueContainer<DOMRect | undefined>();
export const useSelectionRect = () => useValue(selectionRectContainer);
-const assetsContainer = createValueContainer<Array<BaseAsset>>([]);
+const assetsContainer = createValueContainer<Array<Asset>>([]);
export const useAssets = () => useValue(assetsContainer);