Skip to content

Commit

Permalink
Rename Find/Selection components
Browse files Browse the repository at this point in the history
- remove Linear/Circular prefix
- they're already separated by folder
- it also doesn'y  match the pattern of same name, diff folder, used by annotations, index
  • Loading branch information
jjtimmons committed Jul 11, 2022
1 parent 70cbce0 commit 5b8e10a
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions src/SeqViz/Circular/Circular.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import * as React from "react";
import { Annotation, Coor, ICutSite, ISize, InputRefFuncType, Primer, Ranged } from "../../elements";
import bindingSites from "../../utils/bindingSites";
import isEqual from "../../utils/isEqual";
import { HighlightRegion } from "../Linear/SeqBlock/LinearFind";
import { HighlightRegion } from "../Linear/SeqBlock/Find";
import { stackElements } from "../elementsToRows";
import withViewerHOCs from "../handlers";
import CentralIndexContext from "../handlers/centralIndex";
import { SeqVizSelection } from "../handlers/selection";
import Annotations from "./Annotations";
import { CircularFind } from "./CircularFind";
import Selection from "./CircularSelection";
import CutSites from "./CutSites";
import { Find } from "./Find";
import Index from "./Index";
import Labels, { ILabel } from "./Labels";
import Selection from "./Selection";

// this will need to change whenever the css of the plasmid viewer text changes
// just divide the width of some rectangular text by it's number of characters
Expand Down Expand Up @@ -355,7 +355,7 @@ class Circular extends React.Component<CircularProps, CircularState> {
totalRows={totalRows}
yDiff={yDiff}
/>
<CircularFind
<Find
center={general.center}
findCoor={general.findCoor}
generateArc={general.generateArc}
Expand Down
4 changes: 2 additions & 2 deletions src/SeqViz/Circular/CutSites.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";

import { Coor, ICutSite, InputRefFuncType } from "../../elements";
import { CircularFindArc } from "./CircularFind";
import { FindArc } from "./Find";

interface CutSitesProps {
center: Coor;
Expand Down Expand Up @@ -123,7 +123,7 @@ export default class CutSites extends React.PureComponent<CutSitesProps> {
recogHighlightArc = (c: ICutSite) => {
if (c.highlightColor) {
return (
<CircularFindArc
<FindArc
key={`findArc: ${c.id}`}
direction={1}
end={c.end}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from "react";

import { Coor, InputRefFuncType, Ranged } from "../../elements";
import { HighlightRegion } from "../Linear/SeqBlock/LinearFind";
import { HighlightRegion } from "../Linear/SeqBlock/Find";

interface CircularFindProps {
interface FindProps {
center: Coor;
findCoor: (index: number, radius: number, rotate?: boolean) => Coor;
generateArc: (args: {
Expand All @@ -30,11 +30,11 @@ interface CircularFindProps {
totalRows: number;
}

export const CircularFind = (props: CircularFindProps) => {
export const Find = (props: FindProps) => {
const { generateArc, getRotation, highlightedRegions, inputRef, lineHeight, radius, search, seqLength } = props;
const threshold = seqLength >= 200 ? search.length / seqLength <= 0.02 : true;
const searchArcs = search.map(s => (
<CircularFindArc
<FindArc
key={JSON.stringify(s)}
direction={s.direction || 1}
end={s.end}
Expand All @@ -50,7 +50,7 @@ export const CircularFind = (props: CircularFindProps) => {
));

const highlightArcs = highlightedRegions.map(({ color, end, start }) => (
<CircularFindArc
<FindArc
key={JSON.stringify({ end, start })}
direction={1}
end={end}
Expand All @@ -75,7 +75,7 @@ export const CircularFind = (props: CircularFindProps) => {
/**
* Create an SVG `path` element that highlights the search result
*/
export const CircularFindArc = (props: {
export const FindArc = (props: {
direction: -1 | 1;
end: number;
fillStyle: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface CircularSelectionProps {
* if nothing is selected, it should just be the single cursor
* without a middle highlighted region
*/
export default class CircularSelection extends React.PureComponent<CircularSelectionProps> {
export default class Selection extends React.PureComponent<CircularSelectionProps> {
static contextType = SelectionContext;
declare context: React.ContextType<typeof SelectionContext>;

Expand Down
2 changes: 1 addition & 1 deletion src/SeqViz/Linear/Linear.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { createMultiRows, createSingleRows, stackElements } from "../elementsToR
import withViewerHOCs from "../handlers";
import { SeqVizSelection } from "../handlers/selection";
import InfiniteScroll from "./InfiniteScroll";
import { HighlightRegion } from "./SeqBlock/LinearFind";
import { HighlightRegion } from "./SeqBlock/Find";
import SeqBlock from "./SeqBlock/SeqBlock";

export interface LinearProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface FindProps {
/**
* Render rectangles around Search results.
*/
export default function LinearFind(props: FindProps) {
export default function Find(props: FindProps) {
const {
compYDiff,
filteredRows: searchRows,
Expand All @@ -45,7 +45,7 @@ export default function LinearFind(props: FindProps) {
{/* We use two LinearFindBlocks here because we want to span both the top and bottom strand for a highlight */}
{highlightedRegions.map(({ color, end, start }) => (
<React.Fragment key={`highlight-${start}-${end}-1`}>
<LinearFindBlock
<FindBlock
compYDiff={compYDiff}
direction={1}
end={end}
Expand All @@ -59,7 +59,7 @@ export default function LinearFind(props: FindProps) {
seqBlockRef={seqBlockRef}
start={start}
/>
<LinearFindBlock
<FindBlock
compYDiff={compYDiff}
direction={-1}
end={end}
Expand All @@ -76,7 +76,7 @@ export default function LinearFind(props: FindProps) {
</React.Fragment>
))}
{searchRows.map(s => (
<LinearFindBlock
<FindBlock
key={JSON.stringify(s)}
compYDiff={compYDiff}
direction={s.direction || 1}
Expand All @@ -96,7 +96,7 @@ export default function LinearFind(props: FindProps) {
);
}

export const LinearFindBlock = (props: {
export const FindBlock = (props: {
compYDiff: number;
direction: -1 | 1;
end: number;
Expand Down
6 changes: 3 additions & 3 deletions src/SeqViz/Linear/SeqBlock/SeqBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Annotation, ICutSite, ISize, InputRefFuncType, Primer, Ranged } from ".
import { SeqVizSelection } from "../../handlers/selection";
import { AnnotationRows } from "./AnnotationRows";
import CutSiteRow from "./CutSites";
import Find, { HighlightRegion } from "./Find";
import IndexRow from "./Index";
import LinearFind, { HighlightRegion } from "./LinearFind";
import Primers from "./Primers";
import Selection from "./Selection";
import TranslationRows, { Translation } from "./Translations";
Expand Down Expand Up @@ -303,7 +303,7 @@ export default class SeqBlock extends React.PureComponent<SeqBlockProps> {
lastBase={lastBase}
selectEdgeHeight={selectEdgeHeight}
/>
<LinearFind
<Find
compYDiff={compYDiff}
filteredRows={filteredSearchRows}
findXAndWidth={this.findXAndWidth}
Expand Down Expand Up @@ -412,7 +412,7 @@ export default class SeqBlock extends React.PureComponent<SeqBlockProps> {
</text>
) : null}

<LinearFind
<Find
{...this.props}
compYDiff={compYDiff}
filteredRows={filteredSearchRows}
Expand Down
2 changes: 1 addition & 1 deletion src/SeqViz/SeqViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Annotation, ICutSite, Ranged } from "../elements";
import isEqual from "../utils/isEqual";
import Circular from "./Circular/Circular";
import Linear from "./Linear/Linear";
import { HighlightRegion } from "./Linear/SeqBlock/LinearFind";
import { HighlightRegion } from "./Linear/SeqBlock/Find";
import CentralIndexContext from "./handlers/centralIndex";
import { SeqVizSelection } from "./handlers/selection";

Expand Down
2 changes: 1 addition & 1 deletion src/SeqViz/SeqViz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import isEqual from "../utils/isEqual";
import { directionality, dnaComplement } from "../utils/parser";
import search from "../utils/search";
import { annotationFactory, getSeqType } from "../utils/sequence";
import { HighlightRegion } from "./Linear/SeqBlock/LinearFind";
import { HighlightRegion } from "./Linear/SeqBlock/Find";
import SeqViewer from "./SeqViewer";
import CentralIndexContext from "./handlers/centralIndex";
import { SelectionContext, SeqVizSelection, defaultSelection } from "./handlers/selection";
Expand Down

0 comments on commit 5b8e10a

Please sign in to comment.