Skip to content

Commit 086c698

Browse files
authored
Merge pull request #3188 from liam-hq/feature/share-modal-access-visibility
✨ Dynamic share modal access visibility based on share settings
2 parents 3ac7997 + 02b38c2 commit 086c698

File tree

5 files changed

+51
-33
lines changed

5 files changed

+51
-33
lines changed

frontend/apps/app/components/ShareDialog/ShareDialog.module.css

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
.backdrop {
2-
position: fixed;
3-
inset: 0;
4-
background-color: var(--overlay-50);
5-
z-index: var(--z-index-overlay);
6-
}
7-
81
.dialog {
92
position: fixed;
103
top: 50%;
@@ -84,7 +77,13 @@
8477
gap: var(--spacing-6);
8578
}
8679

87-
.accessSection,
80+
.accessSection {
81+
display: flex;
82+
flex-direction: column;
83+
gap: var(--spacing-3);
84+
min-height: 5rem;
85+
}
86+
8887
.visibilitySection {
8988
display: flex;
9089
flex-direction: column;
@@ -96,6 +95,9 @@
9695
font-weight: 500;
9796
color: var(--global-body-text);
9897
margin: 0;
98+
display: flex;
99+
align-items: center;
100+
gap: var(--spacing-2);
99101
}
100102

101103
.userInfo {
@@ -104,36 +106,38 @@
104106
gap: var(--spacing-3);
105107
}
106108

107-
.avatar {
109+
.accessIcon {
108110
width: 2.5rem;
109111
height: 2.5rem;
110-
background: linear-gradient(
111-
135deg,
112-
var(--primary-accent),
113-
var(--primary-hover)
114-
);
112+
background-color: var(--overlay-5);
115113
border-radius: 50%;
116114
display: flex;
117115
align-items: center;
118116
justify-content: center;
119-
font-size: var(--font-size-3);
120-
font-weight: 600;
121-
color: var(--global-background);
117+
color: var(--overlay-50);
118+
transition: opacity 0.3s ease-in-out;
122119
}
123120

124121
.userDetails {
125122
flex: 1;
123+
min-height: 2.75rem;
124+
display: flex;
125+
flex-direction: column;
126+
justify-content: center;
126127
}
127128

128129
.userName {
129130
font-size: var(--font-size-4);
130131
font-weight: 500;
131132
color: var(--global-foreground);
133+
margin-bottom: var(--spacing-1);
134+
transition: opacity 0.2s ease-in-out;
132135
}
133136

134137
.userEmail {
135138
font-size: var(--font-size-2);
136139
color: var(--global-mute-text);
140+
transition: opacity 0.2s ease-in-out;
137141
}
138142

139143
.visibilityControls {
@@ -287,4 +291,6 @@
287291
font-size: var(--font-size-2);
288292
color: var(--global-mute-text);
289293
margin: 0;
294+
min-height: 1rem;
295+
transition: opacity 0.2s ease-in-out;
290296
}

frontend/apps/app/components/ShareDialog/ShareDialog.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client'
22

33
import {
4+
Building2,
45
Check,
56
ChevronDown,
67
Copy,
@@ -9,13 +10,15 @@ import {
910
DropdownMenuPortal,
1011
DropdownMenuRoot,
1112
DropdownMenuTrigger,
13+
Globe,
1214
Link,
1315
Lock,
1416
ModalContent,
1517
ModalOverlay,
1618
ModalPortal,
1719
ModalRoot,
1820
ModalTitle,
21+
Spinner,
1922
XIcon,
2023
} from '@liam-hq/ui'
2124
import { type FC, useRef, useState } from 'react'
@@ -97,12 +100,18 @@ export const ShareDialog: FC<Props> = ({
97100
<div className={styles.accessSection}>
98101
<h4 className={styles.sectionTitle}>People with access</h4>
99102
<div className={styles.userInfo}>
100-
<div className={styles.avatar}>
101-
<span>You</span>
103+
<div className={styles.accessIcon}>
104+
{isPublic ? <Globe size={20} /> : <Building2 size={20} />}
102105
</div>
103106
<div className={styles.userDetails}>
104-
<div className={styles.userName}>You (Owner)</div>
105-
<div className={styles.userEmail}>Has full access</div>
107+
<div className={styles.userName}>
108+
{isPublic ? 'Anyone' : 'Organization members'}
109+
</div>
110+
<div className={styles.userEmail}>
111+
{isPublic
112+
? 'Anyone with the link can view'
113+
: 'Members can view this session'}
114+
</div>
106115
</div>
107116
</div>
108117
</div>
@@ -113,7 +122,8 @@ export const ShareDialog: FC<Props> = ({
113122
id="visibility-section-title"
114123
className={styles.sectionTitle}
115124
>
116-
Visibility
125+
<span>Visibility</span>
126+
{loading && <Spinner size="12" />}
117127
</h4>
118128
<div className={styles.visibilityControls}>
119129
<div className={styles.selectWrapper}>
@@ -200,11 +210,11 @@ export const ShareDialog: FC<Props> = ({
200210
</button>
201211
)}
202212
</div>
203-
{isPublic && (
204-
<p className={styles.visibilityDescription}>
205-
Anyone with the link can view this session
206-
</p>
207-
)}
213+
<p className={styles.visibilityDescription}>
214+
{isPublic
215+
? 'Anyone with the link can view this session'
216+
: 'Only organization members can view this session'}
217+
</p>
208218
</div>
209219
</div>
210220
</div>

frontend/apps/app/eslint-suppressions.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,6 @@
287287
"count": 19
288288
}
289289
},
290-
"components/ShareDialog/ShareDialog.module.css": {
291-
"css-modules-kit/no-unused-class-names": {
292-
"count": 1
293-
}
294-
},
295290
"features/organizations/services/getOrganizationId.ts": {
296291
"no-throw-error/no-throw-error": {
297292
"count": 2

frontend/apps/app/hooks/usePublicShareServerAction.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const usePublicShareServerAction = ({
1616
}: UsePublicShareServerActionProps) => {
1717
const [isPublic, setIsPublic] = useState(initialIsPublic)
1818
const [isPending, startTransition] = useTransition()
19+
const [isLoading, setIsLoading] = useState(false)
1920
const isPublicRef = useRef(initialIsPublic)
2021

2122
// Reset state when designSessionId or initialIsPublic changes
@@ -32,6 +33,8 @@ export const usePublicShareServerAction = ({
3233
const togglePublicShare = useCallback(async () => {
3334
const currentIsPublic = isPublicRef.current
3435

36+
setIsLoading(true)
37+
3538
const result = await fromPromise(
3639
currentIsPublic
3740
? disablePublicShare(designSessionId)
@@ -45,6 +48,8 @@ export const usePublicShareServerAction = ({
4548
}),
4649
)
4750

51+
setIsLoading(false)
52+
4853
return result.match(
4954
(data) => {
5055
if (data.success) {
@@ -59,7 +64,7 @@ export const usePublicShareServerAction = ({
5964
}, [designSessionId])
6065
return {
6166
isPublic,
62-
loading: isPending,
67+
loading: isLoading || isPending,
6368
togglePublicShare,
6469
}
6570
}

frontend/packages/ui/src/icons/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export {
55
BookMarked,
66
BookText,
77
Building,
8+
Building2,
89
Check,
910
ChevronDown,
1011
ChevronLeft,
@@ -28,6 +29,7 @@ export {
2829
Fingerprint,
2930
GitBranch,
3031
GitPullRequestArrow,
32+
Globe,
3133
Group,
3234
Hash,
3335
Info,

0 commit comments

Comments
 (0)