-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/#52-right-click-modal
- Loading branch information
Showing
59 changed files
with
892 additions
and
135 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
input LabelClassCreateInput { | ||
id: ID | ||
name: String! | ||
color: ColorHex! | ||
} | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
input LabelCreateInput { | ||
id: ID | ||
imageId: ID! | ||
labelClassId: ID! | ||
labelClassId: ID | ||
x: Float! | ||
y: Float! | ||
width: Int! | ||
|
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
18 changes: 0 additions & 18 deletions
18
typescript/web-app/src/components/drawing-tool-bar/__stories__/index.tsx
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
typescript/web-app/src/components/drawing-tool-bar/index.tsx
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
typescript/web-app/src/components/labelling-tool/__stories__/labelling-tool.tsx
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,50 @@ | ||
import React from "react"; | ||
import { addDecorator, Story } from "@storybook/react"; | ||
import { NextRouter } from "next/router"; | ||
import { Box } from "@chakra-ui/react"; | ||
|
||
import { LabellingTool, Props } from "../labelling-tool"; | ||
import { chakraDecorator } from "../../../utils/chakra-decorator"; | ||
|
||
addDecorator(chakraDecorator); | ||
|
||
export default { | ||
title: "web-app/Labelling Tool", | ||
component: LabellingTool, | ||
}; | ||
|
||
const Template: Story<Props> = (args: Props) => ( | ||
<Box background="gray.100" width="640px" height="480px"> | ||
<LabellingTool {...args} /> | ||
</Box> | ||
); | ||
|
||
const router = { | ||
push: (x: string) => console.log(`Navigate to ${x}`), | ||
} as unknown as NextRouter; | ||
|
||
export const OneImage = Template.bind({}); | ||
OneImage.args = { | ||
image: { | ||
name: "Hello puffin", | ||
id: "toto", | ||
width: 600, | ||
height: 750, | ||
url: "https://images.unsplash.com/photo-1612564148954-59545876eaa0?auto=format&fit=crop&w=600&q=80", | ||
}, | ||
images: [{ id: "toto" }], | ||
router, | ||
}; | ||
|
||
export const ThreeImages = Template.bind({}); | ||
ThreeImages.args = { | ||
image: { | ||
name: "Hello puffin", | ||
id: "toto", | ||
width: 600, | ||
height: 750, | ||
url: "https://images.unsplash.com/photo-1612564148954-59545876eaa0?auto=format&fit=crop&w=600&q=80", | ||
}, | ||
images: [{ id: "titi" }, { id: "toto" }, { id: "tata" }], | ||
router, | ||
}; |
24 changes: 24 additions & 0 deletions
24
...t/web-app/src/components/labelling-tool/drawing-tool-bar/__stories__/drawing-tool-bar.tsx
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,24 @@ | ||
import React from "react"; | ||
import { addDecorator, Story } from "@storybook/react"; | ||
import { VStack } from "@chakra-ui/react"; | ||
|
||
import { chakraDecorator } from "../../../../utils/chakra-decorator"; | ||
|
||
import { DrawingToolbar, Props } from "../drawing-tool-bar"; | ||
|
||
addDecorator(chakraDecorator); | ||
|
||
export default { | ||
title: "web-app/Drawing Toolbar", | ||
component: DrawingToolbar, | ||
}; | ||
|
||
const Template: Story<Props> = (args: Props) => ( | ||
<VStack background="gray.100" padding={4} spacing={4} h="640px" w="72px"> | ||
<DrawingToolbar {...args} /> | ||
</VStack> | ||
); | ||
|
||
// @ts-ignore | ||
export const Default = Template.bind({}); | ||
Default.args = {}; |
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
typescript/web-app/src/components/labelling-tool/drawing-tool-bar/drawing-tool-bar.tsx
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,11 @@ | ||
import { SelectionTool } from "./selection-tool"; | ||
|
||
export type Props = {}; | ||
|
||
export const DrawingToolbar = () => { | ||
return ( | ||
<> | ||
<SelectionTool /> | ||
</> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
typescript/web-app/src/components/labelling-tool/drawing-tool-bar/index.tsx
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 @@ | ||
export { DrawingToolbar } from "./drawing-tool-bar"; |
26 changes: 26 additions & 0 deletions
26
typescript/web-app/src/components/labelling-tool/drawing-tool-bar/selection-tool.tsx
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,26 @@ | ||
import { IconButton, Tooltip } from "@chakra-ui/react"; | ||
import { BiPointer } from "react-icons/bi"; | ||
|
||
import { useHotkeys } from "react-hotkeys-hook"; | ||
|
||
import { keymap } from "../../../keymap"; | ||
|
||
export type Props = {}; | ||
|
||
export const SelectionTool = () => { | ||
useHotkeys(keymap.toolSelect.key, () => console.log("Select tool"), {}, []); | ||
|
||
return ( | ||
<Tooltip | ||
label={`Selection tool [${keymap.toolSelect.key}]`} | ||
placement="right" | ||
> | ||
<IconButton | ||
icon={<BiPointer size="1.3em" />} | ||
backgroundColor="white" | ||
aria-label="Select tool" | ||
pointerEvents="initial" | ||
/> | ||
</Tooltip> | ||
); | ||
}; |
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
File renamed without changes.
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
1 change: 1 addition & 0 deletions
1
typescript/web-app/src/components/labelling-tool/image-navigation-tool-bar/index.tsx
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 @@ | ||
export { ImageNavigationToolbar } from "./image-navigation-tool-bar"; |
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,6 @@ | ||
import { LabellingTool, Props } from "./labelling-tool"; | ||
|
||
export { LabellingTool }; | ||
export type { Props }; | ||
|
||
export default LabellingTool; |
46 changes: 46 additions & 0 deletions
46
typescript/web-app/src/components/labelling-tool/labelling-tool.tsx
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,46 @@ | ||
import { Box, HStack, VStack } from "@chakra-ui/react"; | ||
import { NextRouter } from "next/router"; | ||
|
||
import type { Image } from "../../types.generated"; | ||
|
||
import { OpenlayersMap } from "./openlayers-map"; | ||
import { DrawingToolbar } from "./drawing-tool-bar"; | ||
import { ImageNavigationToolbar } from "./image-navigation-tool-bar"; | ||
|
||
export type Props = { | ||
image?: Pick<Image, "id" | "url" | "name" | "width" | "height">; | ||
images?: Pick<Image, "id">[]; | ||
router: NextRouter; | ||
}; | ||
|
||
export const LabellingTool = ({ image, images, router }: Props) => { | ||
return ( | ||
<Box height="100%" position="relative"> | ||
<OpenlayersMap image={image} /> | ||
<VStack | ||
padding={4} | ||
spacing={4} | ||
position="absolute" | ||
top={0} | ||
left={0} | ||
pointerEvents="none" | ||
> | ||
<DrawingToolbar /> | ||
</VStack> | ||
<HStack | ||
padding={4} | ||
spacing={4} | ||
position="absolute" | ||
bottom={0} | ||
left={0} | ||
pointerEvents="none" | ||
> | ||
<ImageNavigationToolbar | ||
imageId={image?.id} | ||
images={images} | ||
router={router} | ||
/> | ||
</HStack> | ||
</Box> | ||
); | ||
}; |
3 changes: 3 additions & 0 deletions
3
typescript/web-app/src/components/labelling-tool/openlayers-map/index.tsx
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,3 @@ | ||
import { OpenlayersMap } from "./openlayers-map"; | ||
|
||
export { OpenlayersMap }; |
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.