Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/comment section stretching #7402

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/Components/Shifting/CommentsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,32 @@ export const Comment = ({
modified_date,
}: IComment) => {
const { t } = useTranslation();
const [expanded, setExpanded] = useState(false);
const toggleExpanded = () => {
setExpanded(!expanded);
};
const truncatedComment = comment.split(" ").slice(0, 20).join(" ");
const remainingComment = comment.split(" ").slice(20).join(" ");

return (
<div
key={id}
className="mt-4 flex w-full flex-col rounded-lg border border-gray-300 bg-white p-4 text-gray-800"
>
<div className="flex w-full ">
<p className="text-justify">{comment}</p>
<p className="text-justify">
{expanded ? comment : truncatedComment}
{!expanded && remainingComment && (
<button onClick={toggleExpanded} className="ml-2 text-green-600">
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
{t("read_more")}
</button>
)}
{expanded && remainingComment && (
<button onClick={toggleExpanded} className="ml-2 text-green-600">
{t("read_less")}
</button>
)}
</p>
</div>
<div className="mt-3">
<span className="text-xs text-gray-500">
Expand Down
32 changes: 25 additions & 7 deletions src/Components/Shifting/ShiftDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export default function ShiftDetails(props: { id: string }) {

const showFacilityCard = (facilityData: any) => {
return (
<div className="mt-2 h-full rounded-lg border bg-white p-4 text-black shadow">
<div className="mt-2 rounded-lg border bg-white p-4 text-black shadow lg:h-[25vh] lg:w-[30vw]">
<div>
<span className="mr-1 font-semibold leading-relaxed">
{t("name")}:{" "}
Expand Down Expand Up @@ -796,10 +796,6 @@ export default function ShiftDetails(props: { id: string }) {
</h4>
{showPatientCard(data?.patient_object)}
</div>
<div className="mb-10 mr-3 md:mr-8">
<h4 className="mt-8">{t("comments")}</h4>
<CommentSection id={props.id} />
</div>
</div>

<div className="col-span-2">
Expand Down Expand Up @@ -838,12 +834,12 @@ export default function ShiftDetails(props: { id: string }) {

{showFacilityCard(data?.origin_facility_object)}
</div>
{!data?.assigned_facility_external && (
{/* {!data?.assigned_facility_external && (
<div>
<h4 className="mt-8">{t("details_of_assigned_facility")}</h4>
{showFacilityCard(data?.assigned_facility_object)}
</div>
)}
)} */}
{wartime_shifting && (
<div>
<h4 className="mt-8">
Expand All @@ -853,6 +849,28 @@ export default function ShiftDetails(props: { id: string }) {
</div>
)}
</div>
<div
className="Details of assigned facility flex w-full flex-col lg:flex-row

"
>
<div className="Details of assigned facility">
{!data?.assigned_facility_external && (
<div className=" w-full lg:w-[50vw]">
<h4 className="mt-8">
{t("details_of_assigned_facility")}
</h4>
{showFacilityCard(data?.assigned_facility_object)}
</div>
)}
</div>
</div>
</div>
<div className="">
<div className="mb-10 mr-3 md:mr-8">
<h4 className="mt-8">{t("comments")}</h4>
<CommentSection id={props.id} />
</div>
</div>
</Page>
)}
Expand Down
1 change: 0 additions & 1 deletion src/Components/Users/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export type UserModel = UserBareMinimum & {
doctor_medical_council_registration?: string;
weekly_working_hours?: string | null;
};

export interface SkillObjectModel {
id: string;
name: string;
Expand Down
4 changes: 3 additions & 1 deletion src/Locale/en/Shifting.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,7 @@
"transfer_in_progress": "TRANSFER IN PROGRESS",
"patient_state": "Patient State",
"yet_to_be_decided": "Yet to be decided",
"awaiting_destination_approval": "AWAITING DESTINATION APPROVAL"
"awaiting_destination_approval": "AWAITING DESTINATION APPROVAL",
"read_more": "Read More",
"read_less": "Read Less"
}
4 changes: 4 additions & 0 deletions src/Locale/kn/Shifting.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"read_more": "ಇನ್ನಷ್ಟು ಓದಿ",
"read_less": "ಇನ್ನಷ್ಟು ಓದಬೇಕಿಲ್ಲ"
}
2 changes: 2 additions & 0 deletions src/Locale/kn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import Auth from "./Auth.json";
import Common from "./Common.json";
import Entities from "./Entities.json";
import Facility from "./Facility.json";
import Shifting from "./Shifting.json";

export default {
...Auth,
...Common,
...Entities,
...Facility,
...Shifting,
};
4 changes: 4 additions & 0 deletions src/Locale/ml/Shifing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"read_more": "കൂടുതൽ വായിക്കുക",
"read_less": "കുറഞ്ഞത് വായിക്കുക"
}
2 changes: 2 additions & 0 deletions src/Locale/ml/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import Auth from "./Auth.json";
import Common from "./Common.json";
import Entities from "./Entities.json";
import Facility from "./Facility.json";
import Shifting from "./Shifing.json";

export default {
...Auth,
...Common,
...Entities,
...Facility,
...Shifting,
};
4 changes: 4 additions & 0 deletions src/Locale/mr/Shifting.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"read_more": "अधिक वाचा",
"read_less": "कमी वाचा"
}
2 changes: 2 additions & 0 deletions src/Locale/mr/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import Auth from "./Auth.json";
import Common from "./Common.json";
import Entities from "./Entities.json";
import Facility from "./Facility.json";
import Shifting from "./Shifting.json";

export default {
...Auth,
...Common,
...Entities,
...Facility,
...Shifting,
};
4 changes: 4 additions & 0 deletions src/Locale/ta/Shifting.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"read_more": "மேலும் படிக்க",
"read_less": "குறைந்தது படிக்க"
}
2 changes: 2 additions & 0 deletions src/Locale/ta/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import Auth from "./Auth.json";
import Common from "./Common.json";
import Entities from "./Entities.json";
import Facility from "./Facility.json";
import Shifting from "./Shifting.json";

export default {
...Auth,
...Common,
...Entities,
...Facility,
...Shifting,
};
Loading