-
Notifications
You must be signed in to change notification settings - Fork 483
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
New Patient Search and Register UI #9400
Open
shivankacker
wants to merge
24
commits into
form-field-v1
Choose a base branch
from
patient-registration
base: form-field-v1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
2c9c3c1
search page
shivankacker 64168bc
midway
shivankacker ee20536
merge conflicts
shivankacker a320c84
social profile
shivankacker 607eb07
logic
shivankacker 42cd4e9
fix merge conflicts
shivankacker f146193
validations left
shivankacker 2f8671d
complete except some stuff
shivankacker 673cc2f
added validation checks
shivankacker 2f917f9
Merge branch 'form-field-v1' of https://github.com/ohcnetwork/care_fe…
shivankacker 765e657
district autofill fixed
shivankacker fd50078
fixed district and ward on update
shivankacker 6d838e1
add transfer module
shivankacker 65fd607
fix merge conflicts
shivankacker c6da6b8
bug fixes
shivankacker dd9a0cc
fix age field
shivankacker 3ea61dd
switch to absolute imports
shivankacker 9231ecf
fix merge conflicts
shivankacker fda516f
duplicate loading solved, with other coderabbit improvements
shivankacker 4f17160
updates
shivankacker 1e6ba61
fix merge conflicts
shivankacker d24c033
Changes
shivankacker db0d353
listing page changes made
shivankacker 9954b1e
fixes
shivankacker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { useEffect, useState } from "react"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
|
||
import { Button } from "@/components/ui/button"; | ||
|
||
export default function SectionNavigator(props: { | ||
sections: { label: string; id: string }[]; | ||
className?: string; | ||
}) { | ||
const { sections, className } = props; | ||
|
||
const [activeSection, setActiveSection] = useState<string | null>(null); | ||
|
||
useEffect(() => { | ||
const updateActiveSection = () => { | ||
sections.forEach((section) => { | ||
const element = document.getElementById(section.id); | ||
if (element) { | ||
const rect = element.getBoundingClientRect(); | ||
if (rect.top >= 0 && rect.bottom <= window.innerHeight) { | ||
setActiveSection(section.id); | ||
} | ||
} | ||
}); | ||
}; | ||
|
||
const observer = new IntersectionObserver( | ||
(entries) => { | ||
entries.forEach((entry) => { | ||
if (entry.isIntersecting) { | ||
setActiveSection(entry.target.id); | ||
} | ||
}); | ||
}, | ||
{ rootMargin: "0px 0px -80% 0px", threshold: 0.1 }, | ||
); | ||
|
||
sections.forEach((section) => { | ||
const element = document.getElementById(section.id); | ||
if (element) { | ||
observer.observe(element); | ||
} | ||
}); | ||
|
||
updateActiveSection(); // Update on page load | ||
|
||
return () => { | ||
sections.forEach((section) => { | ||
const element = document.getElementById(section.id); | ||
if (element) { | ||
observer.unobserve(element); | ||
} | ||
}); | ||
}; | ||
}, [sections]); | ||
|
||
return ( | ||
<div className={cn("sticky top-4 left-0 flex flex-col w-52", className)}> | ||
{sections.map((section) => ( | ||
<Button | ||
className={cn( | ||
"justify-start bg-transparent shadow-none text-gray-700 hover:bg-black/5", | ||
activeSection === section.id && "text-primary-500 font-semibold", | ||
)} | ||
onClick={() => { | ||
const element = document.getElementById(section.id); | ||
if (element) { | ||
element.scrollIntoView({ behavior: "smooth" }); | ||
} | ||
}} | ||
> | ||
{section.label} | ||
</Button> | ||
))} | ||
shivankacker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
); | ||
} |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reminds me of something I came across while testing the user redesign (forgot about it 😅 ) - Back end designates 3 as Non-binary, so we need to update it there as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets be in sync with the BE