This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 829
Improvements to alt aliases #6180
Closed
aaronraimist
wants to merge
21
commits into
matrix-org:develop
from
aaronraimist:foldleft/alt-alias-dialog
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
c39f788
wip
foldleft 5f75726
Refactor of alt aliases to use react hooks
foldleft 00cd0a9
i guess i18n strings are deterministic by filename
foldleft f56396e
fix style feedback
foldleft 448cd02
Typescriptified PublishedAliases, except imports
foldleft 4c75575
Typescriptified EditableItemList
foldleft a98ce32
Typescriptified OverlaySpinner
foldleft 7b99569
more review feedback
foldleft 5902e74
Merge branch 'develop' into foldleft/alt-alias-dialog
foldleft b9277af
fixup for changes to Field
foldleft 436559a
alias -> address
foldleft e7f9785
Don't dispatch asynchronously to unmounted components
foldleft 718b73c
Align 'are you sure' and buttons right, fix height variation
foldleft bbe82dd
Merge branch 'develop' into foldleft/alt-alias-dialog
aaronraimist b03e4f1
Merge branch 'develop' into foldleft/alt-alias-dialog
aaronraimist 4b88f34
Merge branch 'develop' into foldleft/alt-alias-dialog
aaronraimist d6cd4e5
Make sure tooltip stays visible after clicking Add
aaronraimist 334286b
lint
aaronraimist 869a74d
i18n
aaronraimist f53b44d
lint
aaronraimist 72a3346
lint
aaronraimist 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 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,31 @@ | ||
/* | ||
Copyright 2020 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
.mx_OverlaySpinner { | ||
background: $primary-bg-color; | ||
z-index: 2; | ||
} | ||
|
||
.mx_OverlaySpinner_visible { | ||
opacity: 0.9; | ||
transition: opacity 0.5s ease-in; | ||
} | ||
|
||
.mx_OverlaySpinner_hidden { | ||
opacity: 0; | ||
transition: opacity 0.2s ease-in; | ||
pointer-events: none; | ||
} |
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,92 @@ | ||
/* | ||
Copyright 2020 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import React, {useEffect, useRef, useState, FunctionComponent} from "react"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. applies throughout, as a new requirement: any non-component-property object definition should be padded with spaces. Eg: |
||
import Spinner from "./Spinner"; | ||
|
||
/* | ||
* A component which measures its children, and places a spinner over them | ||
* while 'active' is true. | ||
* We use 'holdOff' and 'holdOver' to shift the animations in time: | ||
* We don't animate instantly to avoid a quick 'ghost' spinner for fast round trips. | ||
* We have a short holdOver to allow the fade out to occur. | ||
*/ | ||
|
||
interface IProps { | ||
active: boolean, | ||
className?: string, | ||
} | ||
|
||
export const OverlaySpinner: FunctionComponent<IProps> = ({active, className, children}) => { | ||
const measured = useRef(null); | ||
const [state, setState] = useState({w: 0, h: 0}); | ||
|
||
const firstMount = useRef(true); | ||
const [holdOver, setHoldOver] = useState(false); | ||
const [holdOff, setHoldOff] = useState(false); | ||
|
||
/* Follow the size of the element we're meant to cover */ | ||
useEffect(() => { | ||
const interval = requestAnimationFrame(() => { | ||
if (!measured.current) return; | ||
setState({ | ||
w: measured.current.clientWidth, | ||
h: measured.current.clientHeight, | ||
}); | ||
}); | ||
return () => cancelAnimationFrame(interval); | ||
}); | ||
|
||
/* If it's not the first mount and the state changes to inactive, | ||
* set 'holdOver' to true so the exit animation can play */ | ||
useEffect(() => { | ||
if (firstMount.current) { | ||
firstMount.current = false; | ||
return; | ||
} | ||
if (!active) { | ||
const handle = setTimeout(setHoldOver, 200, false); | ||
setHoldOver(true); | ||
return () => { | ||
setHoldOver(false); | ||
clearTimeout(handle); | ||
}; | ||
} else { | ||
const handle = setTimeout(setHoldOff, 200, false); | ||
setHoldOff(true); | ||
return () => { | ||
setHoldOff(false); | ||
clearTimeout(handle); | ||
}; | ||
} | ||
}, [active]); | ||
|
||
const visibility = !holdOff && active ? "visible" : "hidden"; | ||
|
||
return (<div className={className} style={{ position: "relative" }}> | ||
<div className={`mx_OverlaySpinner mx_OverlaySpinner_${visibility}`} style={{ | ||
position: "absolute", | ||
width: state.w, | ||
height: state.h, | ||
visibility: active || holdOver ? "visible" : "hidden", | ||
}}><Spinner /></div> | ||
<div ref={measured}> | ||
{children} | ||
</div> | ||
</div>); | ||
} | ||
|
||
export default OverlaySpinner; |
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.
I believe this class got converted in another PR (at least, I remember seeing the name today...). Should be able to use that safely, I hope.