Skip to content

Commit

Permalink
remove debugging code
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikskog committed May 6, 2024
1 parent 35d318c commit 6f408c9
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 54 deletions.
3 changes: 0 additions & 3 deletions apps/dashboard/src/app/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ export function createImageInput<F extends FieldValues>({
control={control}
name={name}
render={({ field }) => {
console.log("I FORM", field.value)
return (
<ImageUpload
onSubmit={(data) => {
Expand Down Expand Up @@ -372,12 +371,10 @@ export function useFormBuilder<T extends z.ZodRawShape>({
<form
onSubmit={(e) => {
e.preventDefault()
console.log(e)
form.handleSubmit((values) => {
return onSubmit(values, form)
})(e)

console.log(form.formState.errors)
}}
>
<Flex direction="column" gap="md">
Expand Down
29 changes: 0 additions & 29 deletions apps/dashboard/src/app/testcomp.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export function CropPreview({ imgSrc, completedCrop, imgRef, scale, hidden }: Sh
: { x: 0, y: 0, width: imgRef.current?.width, height: imgRef.current.height, unit: "px" }
if (imgRef.current && canvasRef.current) {
// We use canvasPreview as it's much faster than imgPreview.
console.log("canvasPreview")
canvasPreview(imgRef.current, canvasRef.current, crop, scale)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ interface Props {
}

export default function ImageUpload({ onSubmit, aspect, defaultValues }: Props) {
console.log("defaultValues", defaultValues)
const [imgSrc, setImgSrc] = useState("")
const [assetKey, setAssetKey] = useState("")
const [scale, setScale] = useState(1)
Expand Down Expand Up @@ -78,12 +77,10 @@ export default function ImageUpload({ onSubmit, aspect, defaultValues }: Props)
async function onSelectFile(e: React.ChangeEvent<HTMLInputElement>) {
if (e.target.files && e.target.files.length > 0) {
const uploadedAsset = await uploadToS3(e.target.files[0])
console.log("uploadedAsset", uploadedAsset)
setAssetKey(uploadedAsset.key)

const url = buildAssetUrl(uploadedAsset.key)

console.log("url", url)

const file = await getFileFromUrl(url)
await loadFile(file)
Expand All @@ -101,7 +98,6 @@ export default function ImageUpload({ onSubmit, aspect, defaultValues }: Props)
}

// Default values are set meaning we are updating an existing image
console.log("toInsert", toInsert)
const res = await updateImage.mutateAsync(toInsert)
onSubmit(res)
return
Expand Down Expand Up @@ -131,7 +127,6 @@ export default function ImageUpload({ onSubmit, aspect, defaultValues }: Props)
async function onSetCrop() {
toggleShowCrop()

console.log("completedCrop", calculateRealCropValues())

let result: Image
if (defaultValues?.id) {
Expand All @@ -144,15 +139,13 @@ export default function ImageUpload({ onSubmit, aspect, defaultValues }: Props)
},
})

console.log("result after update", result)
} else {
result = await createImage.mutateAsync({
assetKey: assetKey,
crop: calculateRealCropValues(),
altText: "Uploaded image",
})

console.log("result after create", result)
}

onSubmit(result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ import type { PixelCrop } from "react-image-crop"
const TO_RADIANS = Math.PI / 180

export async function canvasPreview(image: HTMLImageElement, canvas: HTMLCanvasElement, crop: PixelCrop, scale = 1) {
console.log({
imageWidth: image.width,
imageHeight: image.height,
naturalWidth: image.naturalWidth,
naturalHeight: image.naturalHeight,
crop,
image,
})
const ctx = canvas.getContext("2d")

if (!ctx) {
Expand Down
3 changes: 0 additions & 3 deletions apps/dashboard/src/modules/asset/mutations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export const useUploadAssetToS3 = () => {
const createAsset = useCreateAssetMutation()

return async (file: File) => {
console.log("trying to upload file to s3", file)
const result = await upload(file)
console.log("uploaded file to s3", result)
const inserted = await createAsset.mutateAsync({
metadata: null,
originalFilename: result.originalFilename,
Expand All @@ -27,7 +25,6 @@ export const useUploadAssetToS3 = () => {
export const useCreateImageMutation = () => {
return trpc.asset.createImage.useMutation({
onSuccess(data, variables, context) {
console.log("created image", data)
},
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const CreateOfflineModal: FC<ContextModalProps> = ({ context, id }) => {
title: data.title,
published: data.published,
})
console.log("Created offline")
close()
},
})
Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/src/utils/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export async function s3UploadFile(file: File, fields: Record<string, string>, u
try {
const formData = new FormData()
for (const [key, value] of Object.entries(fields)) {
console.log(key, value)
formData.append(key, value)
}

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/modules/external/s3-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class S3RepositoryImpl implements S3Repository {
mimeType: string,
maxSizeMB: number
): Promise<PresignedPost> {
console.log("Creating presigned post for", bucket, filepath, mimeType, maxSizeMB)
return await _createPresignedPost(this.s3Client, {
Bucket: bucket,
Key: filepath,
Expand Down

0 comments on commit 6f408c9

Please sign in to comment.