Skip to content

Commit b1fac9b

Browse files
Merge pull request #1905 from NullVoxPopuli/improve-share-dialog
Improve share dialog
2 parents 006776a + d9642f1 commit b1fac9b

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

apps/repl/app/components/limber/share.css

+12-1
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,21 @@ button[data-share-button] {
6868
}
6969
}
7070
dialog.preem {
71-
border-radius: 0.25rem;
71+
width: 100dvw;
72+
background: transparent;
73+
display: flex;
74+
justify-content: center;
75+
overflow: hidden;
76+
7277
animation: var(--animation-slide-in-up), var(--animation-fade-in);
7378
animation-timing-function: var(--ease-out-5);
7479
animation-duration: 0.2s;
80+
81+
> .modal-facade {
82+
background: white;
83+
border-radius: 0.25rem;
84+
width: max-content;
85+
}
7586
}
7687
dialog.preem::backdrop {
7788
backdrop-filter: blur(1px);

apps/repl/app/components/limber/share.gts

+16-5
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,19 @@ export const Share = <template>
3333
</button>
3434

3535
<m.Dialog class="preem" {{focusTrap isActive=m.isOpen}}>
36+
<SaveBanner @isShowing={{isShowing.current}} />
37+
3638
{{#if m.isOpen}}
37-
<ShareModal @onCancel={{m.close}} />
39+
<div class="modal-facade">
40+
<ShareModal @onCancel={{m.close}} />
41+
</div>
3842
{{/if}}
3943
</m.Dialog>
4044
</Modal>
4145
</template>;
4246

4347
class ShareModal extends Component<{ onCancel: () => void }> {
4448
<template>
45-
<SaveBanner @isShowing={{isShowing.current}} />
46-
4749
<header><h2>Share</h2>
4850
<FlatButton {{on "click" @onCancel}} aria-label="close this share modal">
4951
<FaIcon @size="xs" @icon={{faXmark}} class="aspect-square" />
@@ -127,8 +129,17 @@ class ShareModal extends Component<{ onCancel: () => void }> {
127129

128130
try {
129131
await this.toClipboard();
130-
} catch {
131-
// TODO: Toast message
132+
} catch (e) {
133+
if (typeof e === 'object' && e !== null) {
134+
if ('message' in e && typeof e.message === 'string') {
135+
this.error = e.message;
136+
137+
return;
138+
}
139+
}
140+
141+
console.error(e);
142+
this.error = `An unknown error occurred. Details in the console. If you have time, a bug report would be appreciated <3`;
132143
}
133144
};
134145
}

0 commit comments

Comments
 (0)