Skip to content

Commit

Permalink
fix: download asset only if they are marked as distributatble (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravij3 authored Jul 11, 2023
1 parent c11edf2 commit 93f9c1b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions web/src/components/single/AssetVisualizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function AssetVisualizer(props: AssetVisualizerPropTypes) {
assetId={props.asset?.assetId}
databaseId={props.asset?.databaseId}
assetName={props.asset?.assetName}
isDistributable={props.asset?.isDistributable}
/>
)}
</div>
Expand Down
3 changes: 3 additions & 0 deletions web/src/components/single/ViewAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ export default function ViewAsset() {
assetId={asset?.assetId}
databaseId={asset?.databaseId}
assetName={asset?.assetName}
isDistributable={
asset?.isDistributable
}
/>
)}
</div>
Expand Down
11 changes: 2 additions & 9 deletions web/src/components/viewers/FolderActionViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useNavigate, useParams } from "react-router";
export class FolderActionProps {
databaseId!: string;
assetId!: string;
isDistributable!: boolean;
name!: string;
urlKey!: string;
isDirectory!: boolean;
Expand Down Expand Up @@ -43,7 +44,7 @@ export default function FolderActionViewer({ name, urlKey, ...props }: FolderAct
Selected {props.isDirectory ? "directory" : "file"} : {name}
</p>

{!props.isDirectory && (
{!props.isDirectory && props.isDistributable && (
<>
<ColumnLayout columns={4}>
<Button
Expand All @@ -70,14 +71,6 @@ export default function FolderActionViewer({ name, urlKey, ...props }: FolderAct
<Button variant={"primary"} onClick={() => navigateToAssetFilePage()}>
View {props.isDirectory ? "directory" : "file"}
</Button>
{props.isDirectory && (
<>
<ColumnLayout columns={4}>
<Button> Add a Folder </Button>
<Button> Add a File </Button>
</ColumnLayout>
</>
)}
</p>
</>
)}
Expand Down
10 changes: 9 additions & 1 deletion web/src/components/viewers/FolderViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,27 @@ class FolderViewerProps {
databaseId!: string;
assetId!: string;
assetName!: string;
isDistributable!: boolean;
}

class AssetFileList {
key!: string;
relativePath!: string;
}

export default function FolderViewer({ databaseId, assetId, assetName }: FolderViewerProps) {
export default function FolderViewer({
databaseId,
assetId,
assetName,
isDistributable,
}: FolderViewerProps) {
const [folderActionProps, setFolderActionProps] = useState<FolderActionProps>({
databaseId,
assetId,
name: "",
urlKey: "",
isDirectory: true,
isDistributable: isDistributable,
});

const [treeState, setTreeState] = useState<NodeData>({
Expand Down Expand Up @@ -145,6 +152,7 @@ export default function FolderViewer({ databaseId, assetId, assetName }: FolderV
name={folderActionProps.name}
urlKey={folderActionProps.urlKey}
isDirectory={folderActionProps.isDirectory}
isDistributable={folderActionProps.isDistributable}
/>
</div>
</ColumnLayout>
Expand Down

0 comments on commit 93f9c1b

Please sign in to comment.