Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
to
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
matrix
to
Commits
e6b9325d
Commit
e6b9325d
authored
4 years ago
by
Jorik Schellekens
Browse files
Options
Downloads
Patches
Plain Diff
Display correct client link by default
parent
74d223e4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/InviteTile.tsx
+65
-19
65 additions, 19 deletions
src/components/InviteTile.tsx
src/components/LinkPreview.tsx
+16
-3
16 additions, 3 deletions
src/components/LinkPreview.tsx
src/layouts/SingleColumn.scss
+5
-0
5 additions, 0 deletions
src/layouts/SingleColumn.scss
with
86 additions
and
22 deletions
src/components/InviteTile.tsx
+
65
−
19
View file @
e6b9325d
...
@@ -14,43 +14,89 @@ See the License for the specific language governing permissions and
...
@@ -14,43 +14,89 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
import
React
from
'
react
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
'
./InviteTile.scss
'
;
import
'
./InviteTile.scss
'
;
import
Tile
from
'
./Tile
'
;
import
Tile
from
'
./Tile
'
;
import
LinkButton
from
'
./LinkButton
'
;
import
LinkButton
from
'
./LinkButton
'
;
import
TextButton
from
'
./TextButt
on
'
;
import
ClientSelection
from
'
./ClientSelecti
on
'
;
import
{
Client
,
ClientKind
}
from
'
../clients/types
'
;
import
{
Client
,
ClientKind
}
from
'
../clients/types
'
;
import
{
SafeLink
}
from
'
../parser/types
'
;
import
{
SafeLink
}
from
'
../parser/types
'
;
import
TextButton
from
'
./TextButton
'
;
interface
IProps
{
interface
IProps
{
children
?:
React
.
ReactNode
;
children
?:
React
.
ReactNode
;
client
:
Client
;
client
:
Client
|
null
;
link
:
SafeLink
;
link
:
SafeLink
;
}
}
const
InviteTile
:
React
.
FC
<
IProps
>
=
({
children
,
client
,
link
}:
IProps
)
=>
{
const
InviteTile
:
React
.
FC
<
IProps
>
=
({
children
,
client
,
link
}:
IProps
)
=>
{
const
[
showAdvanced
,
setShowAdvanced
]
=
useState
(
false
);
let
invite
:
React
.
ReactNode
;
let
invite
:
React
.
ReactNode
;
switch
(
client
.
kind
)
{
let
advanced
:
React
.
ReactNode
;
case
ClientKind
.
LINKED_CLIENT
:
// This i s a hacky way to get a the overlapping list of client
invite
=
(
// options working.
<
LinkButton
href
=
{
client
.
toUrl
(
link
).
toString
()
}
>
let
advancedPlaceholder
:
React
.
ReactNode
;
Accept invite
</
LinkButton
>
if
(
client
===
null
)
{
);
invite
=
null
;
break
;
}
else
{
case
ClientKind
.
TEXT_CLIENT
:
let
inviteUseString
:
string
;
invite
=
<
p
>
{
client
.
toInviteString
(
link
)
}
</
p
>;
break
;
switch
(
client
.
kind
)
{
case
ClientKind
.
LINKED_CLIENT
:
invite
=
(
<
LinkButton
href
=
{
client
.
toUrl
(
link
).
toString
()
}
>
Accept invite
</
LinkButton
>
);
inviteUseString
=
`Accepting will open
${
link
.
identifier
}
in
${
client
.
name
}
.`
;
break
;
case
ClientKind
.
TEXT_CLIENT
:
// TODO: copy to clipboard
invite
=
<
p
>
{
client
.
toInviteString
(
link
)
}
</
p
>;
inviteUseString
=
`These are instructions for
${
client
.
name
}
.`
;
break
;
}
const
advancedToggle
=
showAdvanced
?
(
<
TextButton
onClick
=
{
():
void
=>
setShowAdvanced
(
!
showAdvanced
)
}
>
Hide advanced options
</
TextButton
>
)
:
(
<
p
>
{
inviteUseString
}
<
TextButton
onClick
=
{
():
void
=>
setShowAdvanced
(
!
showAdvanced
)
}
>
Change Client.
</
TextButton
>
</
p
>
);
invite
=
(
<>
{
invite
}
{
advancedToggle
}
</>
);
}
if
(
client
===
null
||
showAdvanced
)
{
advanced
=
<
ClientSelection
link
=
{
link
}
/>;
advancedPlaceholder
=
<
div
className
=
"advancedPlaceholder"
/>;
}
}
return
(
return
(
<
Tile
className
=
"inviteTile"
>
<>
{
children
}
<
Tile
className
=
"inviteTile"
>
{
invite
}
{
children
}
<
TextButton
>
Advanced options
</
TextButton
>
{
invite
}
</
Tile
>
{
advancedPlaceholder
}
</
Tile
>
{
advanced
}
</>
);
);
};
};
...
...
This diff is collapsed.
Click to expand it.
src/components/LinkPreview.tsx
+
16
−
3
View file @
e6b9325d
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
,
useContext
}
from
'
react
'
;
import
{
getEvent
,
client
}
from
'
matrix-cypher
'
;
import
{
getEvent
,
client
}
from
'
matrix-cypher
'
;
import
{
RoomPreviewWithTopic
}
from
'
./RoomPreview
'
;
import
{
RoomPreviewWithTopic
}
from
'
./RoomPreview
'
;
...
@@ -22,13 +22,14 @@ import InviteTile from './InviteTile';
...
@@ -22,13 +22,14 @@ import InviteTile from './InviteTile';
import
{
SafeLink
,
LinkKind
}
from
'
../parser/types
'
;
import
{
SafeLink
,
LinkKind
}
from
'
../parser/types
'
;
import
UserPreview
from
'
./UserPreview
'
;
import
UserPreview
from
'
./UserPreview
'
;
import
EventPreview
from
'
./EventPreview
'
;
import
EventPreview
from
'
./EventPreview
'
;
import
C
lient
s
from
'
../clients
'
;
import
{
c
lient
Map
}
from
'
../clients
'
;
import
{
import
{
getRoomFromId
,
getRoomFromId
,
getRoomFromAlias
,
getRoomFromAlias
,
getRoomFromPermalink
,
getRoomFromPermalink
,
getUser
,
getUser
,
}
from
'
../utils/cypher-wrapper
'
;
}
from
'
../utils/cypher-wrapper
'
;
import
{
ClientContext
}
from
'
../contexts/ClientContext
'
;
interface
IProps
{
interface
IProps
{
link
:
SafeLink
;
link
:
SafeLink
;
...
@@ -91,8 +92,20 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => {
...
@@ -91,8 +92,20 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => {
(
async
():
Promise
<
void
>
=>
setContent
(
await
invite
({
link
})))();
(
async
():
Promise
<
void
>
=>
setContent
(
await
invite
({
link
})))();
},
[
link
]);
},
[
link
]);
const
[{
rememberSelection
,
clientId
}]
=
useContext
(
ClientContext
);
// Select which client to link to
const
displayClientId
=
rememberSelection
&&
clientId
?
clientId
:
link
.
arguments
.
client
?
link
.
arguments
.
client
:
null
;
const
client
=
displayClientId
?
clientMap
[
displayClientId
]
:
null
;
return
(
return
(
<
InviteTile
client
=
{
C
lient
s
[
0
]
}
link
=
{
link
}
>
<
InviteTile
client
=
{
c
lient
}
link
=
{
link
}
>
{
content
}
{
content
}
</
InviteTile
>
</
InviteTile
>
);
);
...
...
This diff is collapsed.
Click to expand it.
src/layouts/SingleColumn.scss
+
5
−
0
View file @
e6b9325d
...
@@ -10,4 +10,9 @@
...
@@ -10,4 +10,9 @@
row-gap
:
60px
;
row-gap
:
60px
;
align-items
:
center
;
align-items
:
center
;
.advanced
{
position
:
relative
;
top
:
-335px
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment