Skip to content

Commit

Permalink
Merge pull request #8920 from ohcnetwork/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad authored Oct 24, 2024
2 parents b6e5fa7 + c62b36d commit eb425c8
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 30 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build
.dockerignore
Dockerfile
.git
apps
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ REACT_CARE_API_URL=https://careapi.ohc.network
# Dev envs
ESLINT_NO_DEV_ERRORS=true
CARE_CDN_URL="https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com http://localhost:4566"
REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn"
REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn"

REACT_ENABLED_APPS="ohcnetwork/care_livekit_fe@main"
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ WORKDIR /app

ENV NODE_OPTIONS="--max-old-space-size=4096"

RUN if [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ]; then apt-get update && apt-get install -y python3-dev make g++; fi
RUN apt-get update && apt-get install -y git

RUN if [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ]; then apt-get install -y python3-dev make g++; fi


COPY package.json package-lock.json ./

RUN npm install

COPY . .

RUN npm run setup

RUN npm run build


Expand Down
45 changes: 32 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions scripts/setup-care-apps.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { execSync } = require("child_process");
const { execSync, spawnSync } = require("child_process");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fs = require("fs");
// eslint-disable-next-line @typescript-eslint/no-var-requires
Expand Down Expand Up @@ -33,12 +33,12 @@ const installApp = (app) => {
const appDir = path.join(appsDir, app.package.split("/")[1]);

console.log(`Cloning ${app.package}...`);
execSync(
`npx -y gitget ${app.package}${app.branch ? `#${app.branch}` : ""} apps/${app.package.split("/")[1]} `,
{
stdio: "inherit",
},
);

const cloneUrl = `https://github.com/${app.package.replace("github:", "")}.git`;
const branchOption = app.branch ? ["--branch", app.branch] : [];

spawnSync("git", ["clone", ...branchOption, cloneUrl, appDir]);

// Create a care-package.lock file
fs.writeFileSync(
path.join(appDir, "care-package.lock"),
Expand Down
15 changes: 9 additions & 6 deletions src/components/Common/AvatarEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const VideoConstraints = {
},
} as const;

const isImageFile = (file?: File) => file?.type.split("/")[0] === "image";

type IVideoConstraint =
(typeof VideoConstraints)[keyof typeof VideoConstraints];

Expand Down Expand Up @@ -87,19 +89,20 @@ const AvatarEditModal = ({
};

useEffect(() => {
if (selectedFile) {
const objectUrl = URL.createObjectURL(selectedFile);
setPreview(objectUrl);
return () => URL.revokeObjectURL(objectUrl);
if (!isImageFile(selectedFile)) {
return;
}
const objectUrl = URL.createObjectURL(selectedFile!);
setPreview(objectUrl);
return () => URL.revokeObjectURL(objectUrl);
}, [selectedFile]);

const onSelectFile: ChangeEventHandler<HTMLInputElement> = (e) => {
if (!e.target.files || e.target.files.length === 0) {
setSelectedFile(undefined);
return;
}
if (e.target.files[0]?.type.split("/")[0] !== "image") {
if (!isImageFile(e.target.files[0])) {
Warn({ msg: "Please upload an image file!" });
return;
}
Expand Down Expand Up @@ -134,7 +137,7 @@ const AvatarEditModal = ({
dragProps.setDragOver(false);
setIsDragging(false);
const droppedFile = e?.dataTransfer?.files[0];
if (droppedFile.type.split("/")[0] !== "image")
if (!isImageFile(droppedFile))
return dragProps.setFileDropError("Please drop an image file to upload!");
setSelectedFile(droppedFile);
};
Expand Down

0 comments on commit eb425c8

Please sign in to comment.