Merge branch 'staging' into dev
This commit is contained in:
commit
72fc1f49c6
1
.ssh/id_rsa.pub
Normal file
1
.ssh/id_rsa.pub
Normal file
@ -0,0 +1 @@
|
|||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDOfOFPvQNw5XguFuX1YNvED8ulP+tIA/5xw7LHcA0gRj3hwILCAEAjuDs+d13zCsnEb0yd+laT3PU9iRIKa28Tynu+sTjGDyfx8MX/HjJtbEzyd6jLn87uTvw/6lzg2y5ZDEa6PEqrPIv0KEhuq6HuU8qAA0nBpsTIAUTK3XR8qm3I6J9Rs1JyBjvIP5UeICApvoLmgHuz6mKdvoQ8qKDWamsL4pSc4Hr7HlQ8ITNhnyS8XMgQInU/I2TzT/I4Dxx5IeFUQ5KOfJJNgK1d+PByLSWUrn+eRXki8m1hjMiwGIehVAriFW1C309SEHxLHjQKUPXHSv4kH7zqjO+p3kY5gwp/lvsBRSnihj8s1lADsJlMqjnSLeIQ+sY2CNkmXXI8ABkzhuJKTGTl+8pzGGhIHzeU7e7lpSn3gLn4p217kIppHNAr6dZH9UaYbgnwVonwr5cLbatRPFyI1NfXKDyZtSYlGQxLQUt9KDrNvVTZzaTt3YwM/YCsRIADAagKosM= gisele-smartchain@MacBook-Pro-6.local
|
44
Dockerfile.front
Normal file
44
Dockerfile.front
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# Install dependencies only when needed
|
||||||
|
FROM node:19-alpine AS deps
|
||||||
|
|
||||||
|
WORKDIR leCoffre-front
|
||||||
|
|
||||||
|
COPY package.json ./
|
||||||
|
|
||||||
|
RUN apk update && apk add openssh-client git
|
||||||
|
|
||||||
|
COPY id_rsa /root/.ssh/id_rsa
|
||||||
|
RUN chmod 600 ~/.ssh/id_rsa
|
||||||
|
RUN eval "$(ssh-agent -s)" && ssh-add /root/.ssh/id_rsa
|
||||||
|
RUN ssh-keyscan github.com smart-chain-fr/leCoffre-resources.git >> /root/.ssh/known_hosts
|
||||||
|
|
||||||
|
RUN npm install --frozen-lockfile
|
||||||
|
|
||||||
|
# Rebuild the source code only when needed
|
||||||
|
FROM node:19-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR leCoffre-front
|
||||||
|
|
||||||
|
COPY --from=deps leCoffre-front/node_modules ./node_modules
|
||||||
|
COPY --from=deps leCoffre-front/package.json package.json
|
||||||
|
COPY tsconfig.json tsconfig.json
|
||||||
|
COPY src src
|
||||||
|
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Production image, copy all the files and run next
|
||||||
|
FROM node:19-alpine AS production
|
||||||
|
|
||||||
|
WORKDIR leCoffre-front
|
||||||
|
|
||||||
|
RUN adduser -D lecoffreuser --uid 10000 && chown -R lecoffreuser .
|
||||||
|
|
||||||
|
COPY public ./public
|
||||||
|
COPY --from=builder --chown=lecoffreuser leCoffre-front/node_modules ./node_modules
|
||||||
|
COPY --from=builder --chown=lecoffreuser leCoffre-front/.next ./.next
|
||||||
|
COPY --from=builder --chown=lecoffreuser leCoffre-front/package.json ./package.json
|
||||||
|
|
||||||
|
USER lecoffreuser
|
||||||
|
|
||||||
|
CMD ["npm", "run", "start"]
|
||||||
|
EXPOSE 3000
|
@ -53,8 +53,7 @@ export default class Files extends BaseSuperAdmin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getUploadLink(uid: string): string {
|
public getUploadLink(uid: string): string {
|
||||||
console.log("uid", uid);
|
return this.baseURl.concat(`/download/${uid}`);
|
||||||
return this.baseURl.concat(`/upload/${uid}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getByUid(uid: string, q?: any): Promise<File> {
|
public async getByUid(uid: string, q?: any): Promise<File> {
|
||||||
|
@ -66,6 +66,10 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
.loader {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cross {
|
.cross {
|
||||||
|
@ -16,6 +16,7 @@ import classNames from "classnames";
|
|||||||
import Confirm from "../Modal/Confirm";
|
import Confirm from "../Modal/Confirm";
|
||||||
import InputField from "../Form/Elements/InputField";
|
import InputField from "../Form/Elements/InputField";
|
||||||
import GreenCheckIcon from "@Assets/Icons/green-check.svg";
|
import GreenCheckIcon from "@Assets/Icons/green-check.svg";
|
||||||
|
import Loader from "../Loader";
|
||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
defaultFiles?: FileCustomer[];
|
defaultFiles?: FileCustomer[];
|
||||||
@ -28,6 +29,7 @@ type IFile = {
|
|||||||
file: File;
|
file: File;
|
||||||
uid: string;
|
uid: string;
|
||||||
archived: Date | null;
|
archived: Date | null;
|
||||||
|
fileName: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type IState = {
|
type IState = {
|
||||||
@ -36,6 +38,7 @@ type IState = {
|
|||||||
currentFiles?: FileCustomer[];
|
currentFiles?: FileCustomer[];
|
||||||
refusedReason?: string;
|
refusedReason?: string;
|
||||||
isShowRefusedReasonModalVisible: boolean;
|
isShowRefusedReasonModalVisible: boolean;
|
||||||
|
loading: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class DepositDocument extends React.Component<IProps, IState> {
|
export default class DepositDocument extends React.Component<IProps, IState> {
|
||||||
@ -51,6 +54,7 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
|||||||
currentFiles: this.props.defaultFiles,
|
currentFiles: this.props.defaultFiles,
|
||||||
refusedReason: "",
|
refusedReason: "",
|
||||||
isShowRefusedReasonModalVisible: false,
|
isShowRefusedReasonModalVisible: false,
|
||||||
|
loading: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addDocument = this.addDocument.bind(this);
|
this.addDocument = this.addDocument.bind(this);
|
||||||
@ -118,7 +122,7 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
|||||||
<div className={classes["left-part"]}>
|
<div className={classes["left-part"]}>
|
||||||
<Image src={DocumentCheckIcon} alt="Document check" />
|
<Image src={DocumentCheckIcon} alt="Document check" />
|
||||||
<Typography typo={ITypo.P_16} color={ITypoColor.GREY}>
|
<Typography typo={ITypo.P_16} color={ITypoColor.GREY}>
|
||||||
{this.shortName(fileObj.name)}
|
{this.shortName(file.fileName || fileObj.name)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Image
|
<Image
|
||||||
@ -131,6 +135,19 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
{this.state.loading && (
|
||||||
|
<div className={classes["file-container"]}>
|
||||||
|
<div className={classes["left-part"]}>
|
||||||
|
<div className={classes["loader"]}>
|
||||||
|
<Loader />
|
||||||
|
</div>
|
||||||
|
<Typography typo={ITypo.P_16} color={ITypoColor.GREY}>
|
||||||
|
Chargement...
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<div />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{this.props.document.document_status !== EDocumentStatus.VALIDATED && (
|
{this.props.document.document_status !== EDocumentStatus.VALIDATED && (
|
||||||
@ -174,6 +191,7 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
|||||||
index: this.index++,
|
index: this.index++,
|
||||||
file: new File([""], file.file_path ?? "", {}),
|
file: new File([""], file.file_path ?? "", {}),
|
||||||
uid: file.uid!,
|
uid: file.uid!,
|
||||||
|
fileName: file.file_name,
|
||||||
archived: file.archived_at ? new Date(file.archived_at) : null,
|
archived: file.archived_at ? new Date(file.archived_at) : null,
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
@ -276,12 +294,15 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
|||||||
formData.append("file", file, file.name);
|
formData.append("file", file, file.name);
|
||||||
const query = JSON.stringify({ document: { uid: this.props.document.uid } });
|
const query = JSON.stringify({ document: { uid: this.props.document.uid } });
|
||||||
formData.append("q", query);
|
formData.append("q", query);
|
||||||
|
this.setState({
|
||||||
|
loading: true,
|
||||||
|
});
|
||||||
const newFile = await Files.getInstance().post(formData);
|
const newFile = await Files.getInstance().post(formData);
|
||||||
const files = this.state.currentFiles ? [...this.state.currentFiles, newFile] : [newFile];
|
const files = this.state.currentFiles ? [...this.state.currentFiles, newFile] : [newFile];
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
currentFiles: files,
|
currentFiles: files,
|
||||||
|
loading: false,
|
||||||
files: [
|
files: [
|
||||||
...this.state.files,
|
...this.state.files,
|
||||||
{
|
{
|
||||||
@ -289,6 +310,7 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
|||||||
file: file,
|
file: file,
|
||||||
uid: newFile.uid!,
|
uid: newFile.uid!,
|
||||||
archived: null,
|
archived: null,
|
||||||
|
fileName: newFile?.file_name ?? "",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
@ -5,12 +5,14 @@ import classes from "./classes.module.scss";
|
|||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
href: string;
|
href: string;
|
||||||
|
fileName?: string;
|
||||||
};
|
};
|
||||||
type IState = {};
|
type IState = {};
|
||||||
|
|
||||||
export default class FilePreview extends React.Component<IProps, IState> {
|
export default class FilePreview extends React.Component<IProps, IState> {
|
||||||
override render() {
|
override render() {
|
||||||
const type = this.props.href.split(".").pop();
|
let type = this.props.href.split(".").pop();
|
||||||
|
if(this.props.fileName) type = this.props.fileName.split(".").pop();
|
||||||
return (
|
return (
|
||||||
<div className={classes["root"]}>
|
<div className={classes["root"]}>
|
||||||
{!type && (
|
{!type && (
|
||||||
@ -18,14 +20,12 @@ export default class FilePreview extends React.Component<IProps, IState> {
|
|||||||
Erreur lors du chargement du fichier
|
Erreur lors du chargement du fichier
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
{type && (
|
|
||||||
<div className={classes["file-container"]}>
|
<div className={classes["file-container"]}>
|
||||||
{type === "pdf" && (
|
{type?.toLowerCase() === "pdf" && (
|
||||||
<embed src={this.props.href} width="100%" height="100%" type="application/pdf" className={classes["pdf"]} />
|
<embed src={this.props.href} width="100%" height="100%" type="application/pdf" className={classes["pdf"]} />
|
||||||
)}
|
)}
|
||||||
{type !== "pdf" && <img src={this.props.href} alt="File preview" className={classes["image"]} />}
|
{type?.toLowerCase() !== "pdf" && <img src={this.props.href} alt="File preview" className={classes["image"]} />}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
@import "@Themes/constants.scss";
|
@keyframes s2 {
|
||||||
|
to {
|
||||||
|
transform: rotate(1turn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.loader {
|
.root {
|
||||||
animation: spin 2s linear infinite;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
@keyframes spin {
|
border: 8px solid;
|
||||||
from {
|
border-color: var(--grey-soft);
|
||||||
transform: rotate(0deg);
|
border-right-color: var(--blue-soft);
|
||||||
}
|
animation: s2 1s infinite linear;
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import LoaderIcon from "@Assets/Icons/loader.svg";
|
|
||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
import Image from "next/image";
|
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
export default class Loader extends React.Component<IProps> {
|
export default class Loader extends React.Component<IProps> {
|
||||||
public override render(): JSX.Element {
|
public override render(): JSX.Element {
|
||||||
return <Image src={LoaderIcon} className={[classes["loader"], this.props.className].filter(Boolean).join(" ")} alt={"Loader"} />;
|
return <div className={classes["root"]}></div>;
|
||||||
// <LoaderIcon className={[classes["loader"], this.props.className].filter(Boolean).join(" ")} />;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,6 +91,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
<div className={classes["file-container"]}>
|
<div className={classes["file-container"]}>
|
||||||
<FilePreview
|
<FilePreview
|
||||||
href={Files.getInstance().getUploadLink(this.state.selectedFile?.uid as string)}
|
href={Files.getInstance().getUploadLink(this.state.selectedFile?.uid as string)}
|
||||||
|
fileName={this.state.selectedFile.file_name}
|
||||||
key={this.state.selectedFile.uid}
|
key={this.state.selectedFile.uid}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user