-
Notifications
You must be signed in to change notification settings - Fork 47
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 update/cesium
- Loading branch information
Showing
41 changed files
with
1,116 additions
and
257 deletions.
There are no files selected for viewing
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,35 @@ | ||
name: Upload Cesium Ion token | ||
on: | ||
workflow_call: | ||
inputs: | ||
gcs_dst: | ||
type: string | ||
required: true | ||
secrets: | ||
credentials_json: | ||
required: true | ||
jobs: | ||
upload: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
packages: write | ||
steps: | ||
- uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.credentials_json }} | ||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v2 | ||
- name: Upload Ion token | ||
id: ion_token | ||
run: | | ||
cesium_ion_token_txt_path="/tmp/cesium_ion_token.txt" | ||
curl https://raw.githubusercontent.com/CesiumGS/cesium/main/packages/engine/Source/Core/Ion.js > /tmp/Ion.js | ||
cat /tmp/Ion.js | node -e "console.log(require('fs').readFileSync(process.stdin.fd).toString().match(/const defaultAccessToken =(\n| ).*\"(.*)\";/)[2])" | tr -d '\n' >> ${cesium_ion_token_txt_path} | ||
token_length=$(cat ${cesium_ion_token_txt_path} | wc -c) | ||
if [ $token_length -ne 177 ]; then | ||
echo "Token length is invalid. TokenLength: ${token_length}" | ||
exit 1 | ||
fi | ||
gsutil cp ${cesium_ion_token_txt_path} ${{ inputs.gcs_dst }}/cesium_ion_token.txt |
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,14 @@ | ||
name: Update Cesium Ion token Nightly | ||
|
||
# Every 2nd day of the month at 02:00 JST. | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 17 1 * *' | ||
jobs: | ||
upload: | ||
uses: ./.github/workflows/_upload_cesium_token_txt.yml | ||
with: | ||
gcs_dst: gs://test.reearth.dev | ||
secrets: | ||
credentials_json: ${{ secrets.GCP_SA_KEY }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { css } from "@emotion/react"; | ||
import { Meta, Story } from "@storybook/react"; | ||
|
||
import FloatedPanel, { Props } from "."; | ||
|
||
const meta: Meta<Props> = { | ||
component: FloatedPanel, | ||
}; | ||
|
||
export default meta; | ||
|
||
const Template: Story<Props> = args => <FloatedPanel {...args} />; | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
visible: true, | ||
children: "This is the content of the floated panel", | ||
}; | ||
|
||
export const Hidden = Template.bind({}); | ||
Hidden.args = { | ||
visible: false, | ||
children: "This is the content of the floated panel", | ||
}; | ||
|
||
export const CustomStyles = Template.bind({}); | ||
CustomStyles.args = { | ||
visible: true, | ||
children: "This is the content of the floated panel", | ||
styles: css` | ||
background-color: lightblue; | ||
color: white; | ||
padding: 10px; | ||
`, | ||
}; |
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,11 +1,36 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import InsertionBar from "."; | ||
import InsertionBar, { Props } from "."; | ||
|
||
export default { | ||
const meta: Meta<Props> = { | ||
component: InsertionBar, | ||
} as Meta; | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof InsertionBar>; | ||
|
||
export const Default: Story = {}; | ||
export const Default: Story = { | ||
args: { | ||
pos: "bottom", | ||
mode: "visible", | ||
onButtonClick: () => console.log("Button clicked"), | ||
children: "Insertion bar content", | ||
}, | ||
}; | ||
|
||
export const Hidden: Story = { | ||
args: { | ||
pos: "top", | ||
mode: "hidden", | ||
children: "Insertion bar content", | ||
}, | ||
}; | ||
|
||
export const Dragging: Story = { | ||
args: { | ||
pos: "bottom", | ||
mode: "dragging", | ||
children: "Insertion bar content", | ||
}, | ||
}; |
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
111 changes: 111 additions & 0 deletions
111
web/src/beta/features/Editor/SketchLayerManager/CustomedProperties/PropertyItem.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,111 @@ | ||
import React, { useCallback, useState } from "react"; | ||
|
||
import TextInput from "@reearth/beta/components/fields/common/TextInput"; | ||
import { styled } from "@reearth/services/theme"; | ||
|
||
import { PropertyProps, dataTypes } from ".."; | ||
import { | ||
DeleteButton, | ||
HandleIcon, | ||
PropertyField, | ||
PropertyFieldContanier, | ||
SelectWrapper, | ||
StyledText, | ||
} from "../../utils"; | ||
|
||
type Props = { | ||
property: PropertyProps; | ||
onKeyChange: (newValue?: string) => void; | ||
onValueChange: (newValue?: string) => void; | ||
onRemovePropertyItem: () => void; | ||
}; | ||
|
||
const PropertyItem: React.FC<Props> = ({ | ||
property, | ||
onKeyChange, | ||
onValueChange, | ||
onRemovePropertyItem, | ||
}) => { | ||
const [propertyName, setPropertyName] = useState<string>(property.key); | ||
const [dataType, setDataType] = useState<string>(property.value); | ||
const [isEditName, setIsEditName] = useState(false); | ||
const [isEditType, setIsEditType] = useState(false); | ||
|
||
const handleKeyChange = useCallback( | ||
(newValue: string) => { | ||
setPropertyName(newValue); | ||
onKeyChange(newValue); | ||
if (isEditName) setIsEditName(value => !value); | ||
}, | ||
[isEditName, onKeyChange], | ||
); | ||
|
||
const handleValueChange = useCallback( | ||
(newValue: string) => { | ||
setDataType(newValue); | ||
onValueChange(newValue); | ||
if (isEditType) setIsEditType(value => !value); | ||
}, | ||
[isEditType, onValueChange], | ||
); | ||
|
||
const handleDoubleClick = useCallback((field: string) => { | ||
if (field === "name") { | ||
setIsEditName(true); | ||
} else if (field === "type") { | ||
setIsEditType(true); | ||
} | ||
}, []); | ||
|
||
const handleOnBlur = useCallback(() => { | ||
setIsEditName(false); | ||
}, []); | ||
|
||
return ( | ||
<PropertyFieldContanier> | ||
<PropertyField> | ||
<HandleIcon icon="dndHandle" size={24} /> | ||
{propertyName.trim() === "" || isEditName ? ( | ||
<StyledTextInput value={propertyName} onChange={handleKeyChange} onBlur={handleOnBlur} /> | ||
) : ( | ||
<StyledText onDoubleClick={() => handleDoubleClick("name")} size="footnote"> | ||
{propertyName} | ||
</StyledText> | ||
)} | ||
</PropertyField> | ||
<PropertyField | ||
style={{ | ||
justifyContent: "space-between", | ||
}}> | ||
{dataType.trim() === "" || isEditType ? ( | ||
<StyledSelect | ||
value={dataType} | ||
options={dataTypes.map(v => ({ key: v, label: v }))} | ||
attachToRoot | ||
onChange={handleValueChange} | ||
/> | ||
) : ( | ||
<StyledText onDoubleClick={() => handleDoubleClick("type")} size="footnote"> | ||
{dataType} | ||
</StyledText> | ||
)} | ||
|
||
<DeleteButton icon="trash" size={16} onClick={onRemovePropertyItem} /> | ||
</PropertyField> | ||
</PropertyFieldContanier> | ||
); | ||
}; | ||
|
||
export default PropertyItem; | ||
|
||
const StyledSelect = styled(SelectWrapper)` | ||
margin-top: 0; | ||
padding: 8px 0; | ||
`; | ||
|
||
const StyledTextInput = styled(TextInput)` | ||
width: 100%; | ||
&:focus { | ||
border: 1px solid ${({ theme }) => theme.select.strong}; | ||
} | ||
`; |
Oops, something went wrong.