-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix conflicts and adjust DamFileDownloadLinkBlock
- Loading branch information
1 parent
c2555c6
commit 29bf226
Showing
20 changed files
with
1,128 additions
and
1,024 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,13 +1,4 @@ | ||
import { createCometTheme } from "@comet/admin-theme"; | ||
import type {} from "@mui/lab/themeAugmentation"; | ||
|
||
<<<<<<< HEAD | ||
export default createCometTheme(); | ||
======= | ||
export const theme = createCometTheme(); | ||
|
||
declare module "@mui/styles/defaultTheme" { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface DefaultTheme extends Theme {} | ||
} | ||
>>>>>>> main |
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 |
---|---|---|
|
@@ -156,3 +156,5 @@ export class AppModule { | |
}; | ||
} | ||
} | ||
|
||
// aaaaaaaaaaa |
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,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
/// <reference types="next/navigation-types/compat/navigation" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
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
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
46 changes: 46 additions & 0 deletions
46
packages/api/cms-api/src/dam/blocks/dam-file-download-link-block-transformer.service.ts
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,46 @@ | ||
import { BlockContext, BlockTransformerServiceInterface, TraversableTransformResponse } from "@comet/blocks-api"; | ||
import { Injectable } from "@nestjs/common"; | ||
|
||
import { FilesService } from "../files/files.service"; | ||
import { DamFileDownloadLinkBlockData } from "./dam-file-download-link.block"; | ||
|
||
type TransformResponse = { | ||
damFile?: { | ||
id: string; | ||
name: string; | ||
fileUrl: string; | ||
}; | ||
}; | ||
|
||
@Injectable() | ||
export class DamFileDownloadLinkBlockTransformerService implements BlockTransformerServiceInterface<DamFileDownloadLinkBlockData, TransformResponse> { | ||
constructor(private readonly filesService: FilesService) {} | ||
|
||
async transformToPlain(block: DamFileDownloadLinkBlockData, { includeInvisibleContent, previewDamUrls, relativeDamUrls }: BlockContext) { | ||
const ret: TraversableTransformResponse = { | ||
openFileType: block.openFileType, | ||
}; | ||
|
||
if (block.fileId === undefined) { | ||
return ret; | ||
} | ||
|
||
const file = await this.filesService.findOneById(block.fileId); | ||
|
||
if (file && block.openFileType === "NewTab") { | ||
ret.file = { | ||
id: file.id, | ||
name: file.name, | ||
fileUrl: await this.filesService.createFileUrl(file, { previewDamUrls, relativeDamUrls }), | ||
}; | ||
} else if (file && block.openFileType === "Download") { | ||
ret.file = { | ||
id: file.id, | ||
name: file.name, | ||
fileUrl: await this.filesService.createFileDownloadUrl(file, { previewDamUrls, relativeDamUrls }), | ||
}; | ||
} | ||
|
||
return ret; | ||
} | ||
} |
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
Oops, something went wrong.