-
Notifications
You must be signed in to change notification settings - Fork 0
79 separate exports #80
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
31ea151
Moved useContainerDimensions into separate file
327736e
Blueapi Helpers moved to separate file
a88d627
Changed helper.tsx to .ts
371146b
Merge branch 'main' into 79-Separate_exports
adaudon aa00f06
Prettier fix
6c75526
Fixed PR
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
This file contains hidden or 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 hidden or 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,39 @@ | ||
| import { RawValue } from "../pv/types"; | ||
| import { forceString, ReadPvRawValue } from "../pv/util"; | ||
|
|
||
| /** | ||
| * Read the full visit path from the visit PV set by the beamline staff. | ||
| * @returns {string} the full visit pV /dls/i24/data/{year}/{visit} | ||
| */ | ||
| export function readVisitFromPv(): string { | ||
| const fullVisitPath: RawValue = ReadPvRawValue({ | ||
| label: "visit", | ||
| pv: "ca://BL24I-MO-IOC-13:GP100", | ||
| }); | ||
| const visitString: string = forceString(fullVisitPath); | ||
| return visitString; | ||
| } | ||
|
|
||
| /** | ||
| * Parse the full visit path and return only the instrument session. | ||
| * An error will be raised if the instrument session value is undefined or | ||
| * if the PV is not connected. | ||
| * @param {string} visit The full visit path | ||
| * @returns {string} Only the instrument session part of the visit path | ||
| */ | ||
| export function parseInstrumentSession(visit: string): string { | ||
| let instrumentSession: string | undefined; | ||
| if (visit === "not connected" || visit === "undefined") { | ||
| const msg = | ||
| "Unable to run plan as instrument session not set. Please check visit PV."; | ||
| throw new Error(msg); | ||
| } else { | ||
| instrumentSession = visit.split("/").filter(Boolean).at(-1); | ||
| if (!instrumentSession) { | ||
| throw new Error( | ||
| "Unable to run plan as something appears to be wrong with visit path" | ||
| ); | ||
| } | ||
| } | ||
| return instrumentSession; | ||
| } |
This file contains hidden or 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 hidden or 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,25 @@ | ||
| import { useState, useEffect } from "react"; | ||
|
|
||
| export const useContainerDimensions = ( | ||
| ref: React.MutableRefObject<HTMLHeadingElement | null> | ||
| ) => { | ||
| const [dimensions, setDimensions] = useState({ width: 0, height: 0 }); | ||
| useEffect(() => { | ||
| const getDimensions = () => ({ | ||
| width: ref.current?.offsetWidth || 0, | ||
| height: ref.current?.offsetWidth || 0, | ||
| }); | ||
| const handleResize = () => { | ||
| setDimensions(getDimensions()); | ||
| }; | ||
| if (ref.current) { | ||
| setDimensions(getDimensions()); | ||
| } | ||
| window.addEventListener("resize", handleResize); | ||
| return () => { | ||
| window.removeEventListener("resize", handleResize); | ||
| }; | ||
| }, [ref]); | ||
|
|
||
| return dimensions; | ||
| }; |
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.
Uh oh!
There was an error while loading. Please reload this page.