Skip to content

Commit 2bf7cfc

Browse files
committed
feat: enhance AuthDialog with new styles and speech bubble
- Updated AuthDialog.scss to improve layout and responsiveness, including new animations for the logo and speech bubble. - Modified AuthDialog component to display a random greeting message from a predefined list. - Adjusted styles in index.scss for modal backgrounds to enhance visual consistency. - Improved button styles and layout within the authentication modal for better user experience.
1 parent 8b1fb2f commit 2bf7cfc

File tree

3 files changed

+209
-50
lines changed

3 files changed

+209
-50
lines changed

src/frontend/src/styles/AuthDialog.scss

Lines changed: 132 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,149 @@
11
/* Auth Modal Styles */
22

3+
.excalidraw .Dialog--fullscreen {
4+
.auth-modal {
5+
&__logo-container {
6+
display: none;
7+
}
8+
&__content {
9+
height: 100%;
10+
margin-bottom: 0;
11+
display: flex;
12+
flex-direction: column;
13+
justify-content: space-between;
14+
flex: 1;
15+
}
16+
&__buttons {
17+
margin-bottom: auto;
18+
}
19+
}
20+
21+
.Island {
22+
height: 100%;
23+
display: flex;
24+
flex-direction: column;
25+
}
26+
}
27+
328
.auth-modal {
429

30+
.Island {
31+
padding-top: 15px !important;
32+
padding-bottom: 20px !important;
33+
}
34+
35+
&__wrapper {
36+
position: absolute;
37+
top: 0;
38+
left: 0;
39+
width: 100%;
40+
height: 100%;
41+
z-index: 5;
42+
background-color: rgba(0, 0, 0, 0.2);
43+
backdrop-filter: blur(1px);
44+
}
45+
46+
&__logo-container {
47+
position: relative;
48+
width: fit-content;
49+
width: 100%;
50+
height: 100%;
51+
top: 50%;
52+
left: 50%;
53+
opacity: 0;
54+
animation: logo-fade-in 2s cubic-bezier(0.00, 1.26, 0.64, 0.95) forwards;
55+
animation-delay: 0.5s;
56+
}
57+
58+
@keyframes logo-fade-in {
59+
from {
60+
transform: translate(-270px, -318px);
61+
opacity: 0;
62+
}
63+
to {
64+
transform: translate(-230px, -318px);
65+
opacity: 1;
66+
}
67+
}
68+
69+
&__logo {
70+
width: 60px;
71+
height: 60px;
72+
object-fit: contain;
73+
}
74+
75+
&__logo-speech-bubble {
76+
position: absolute;
77+
background-color: rgb(232, 232, 232);
78+
color: #333;
79+
padding: 8px 12px;
80+
border-radius: 12px;
81+
font-size: 14px;
82+
max-width: 180px;
83+
left: 73px;
84+
top: 0px;
85+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
86+
animation: bubble-appear 0.3s ease-out forwards;
87+
animation-delay: 1.5s;
88+
opacity: 0;
89+
transform: translateY(5px);
90+
91+
&::before {
92+
content: '';
93+
position: absolute;
94+
left: -10px;
95+
top: 10px;
96+
border-width: 5px 10px 5px 0;
97+
border-style: solid;
98+
border-color: transparent rgb(232, 232, 232) transparent transparent;
99+
}
100+
}
101+
102+
@keyframes bubble-appear {
103+
from {
104+
opacity: 0;
105+
transform: translateY(5px);
106+
}
107+
to {
108+
opacity: 1;
109+
transform: translateY(0);
110+
}
111+
}
112+
5113
&__title-container {
6114
display: flex;
7115
align-items: center;
8-
9116
}
10117

11118
&__title {
12119
margin: 0 auto;
13-
font-size: 72px;
120+
font-size: 65px;
14121
font-weight: 700;
15122
color: white;
16123
text-align: center;
17-
display: inline-block;
18124

19125
&-dot {
20126
color: #fa8933;
21127
}
22128
}
23129

130+
&__content {
131+
display: flex;
132+
flex-direction: column;
133+
align-items: center;
134+
}
135+
24136
&__description {
25137
color: #a0a0a9;
26138
font-size: 18px;
27139
line-height: 1.5;
28140
text-align: center;
29141
white-space: pre-line;
30-
padding: 0 90px;
31142
margin-bottom: 40px;
32-
margin-top: 40px;
33-
143+
margin-top: 10px;
144+
min-width: 300px;
145+
max-width: 65%;
146+
34147
.highlight {
35148
color: #cfcfcf;
36149
font-weight: bold;
@@ -42,17 +155,19 @@
42155
align-items: center;
43156
flex-direction: column;
44157
gap: 13px;
45-
margin-bottom: 40px;
158+
width: 100%;
159+
padding-bottom: 50px;
46160

47161
button {
48162
display: flex;
49163
align-items: center;
50164
justify-content: center;
165+
width: 65%;
166+
min-width: 250px;
51167
gap: 8px;
52-
width: 85%;
53168
height: 44px;
54169
border-radius: 6px;
55-
border: 1px solid #727279;
170+
border: 2px solid #727279;
56171
font-size: 15px;
57172
font-weight: 500;
58173
transition: all 0.2s ease;
@@ -61,7 +176,7 @@
61176
color: white;
62177

63178
&:hover {
64-
border: 1px solid #cc6d24;
179+
border: 2px solid #cc6d24;
65180
}
66181
}
67182
}
@@ -74,7 +189,10 @@
74189
gap: 16px;
75190
color: #a0a0a0;
76191
margin-bottom: 10px;
77-
192+
padding-top: 10px;
193+
border-top: 1px solid var(--dialog-border-color);
194+
width: 100%;
195+
78196
&-link {
79197
display: flex;
80198
align-items: center;
@@ -89,9 +207,9 @@
89207
}
90208

91209
&__warning {
92-
text-align: center;
93-
color: #606060bd;
94-
font-size: 12px;
210+
text-align: right;
211+
color: #828282bd;
212+
font-size: 14px;
95213
font-weight: 400;
96214
}
97215
}

src/frontend/src/styles/index.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ body {
6262
}
6363

6464
.excalidraw .Modal__background {
65-
background-color: rgba(0, 0, 0, 0.2);
66-
backdrop-filter: blur(1px);
65+
background-color: rgba(0, 0, 0, 0);
66+
backdrop-filter: blur(0px);
6767
animation: Modal__background__fade-in 0.3s ease-out forwards !important;
6868

6969
&.animations-disabled {

src/frontend/src/ui/AuthDialog.tsx

Lines changed: 75 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from "react";
1+
import React, { useState, useEffect, useMemo } from "react";
22
import { capture } from "../utils/posthog";
33
import { Mail } from "lucide-react";
44
import { queryClient } from "../api/queryClient";
@@ -14,15 +14,48 @@ interface AuthDialogProps {
1414
}
1515

1616
export const AuthDialog = ({
17-
description = <>Welcome to your <strong className="highlight">whiteboard IDE</strong>. <br /><br /> Open <strong className="highlight">terminals</strong> and start coding right away in your own <strong className="highlight">Ubuntu VM</strong>!</>,
18-
warningText = "This is a beta. Backup your work!",
17+
description = <>Welcome to your <strong className="highlight">whiteboard IDE</strong>. <br /><br /> Open <strong className="highlight">terminals</strong>, <strong className="highlight">VSCode</strong> or <strong className="highlight">Cursor</strong> in your pad, and start coding right away.</>,
18+
warningText = <>This is a open-source project in beta.<br /> Backup your work!</>,
1919
onClose,
2020
children,
2121
}: AuthDialogProps) => {
2222
const [modalIsShown, setModalIsShown] = useState(true);
2323

24+
// Array of random messages that the logo can "say"
25+
const logoMessages = [
26+
"Hello there!",
27+
"Welcome to pad.ws!",
28+
"Ready to code?",
29+
"Let's build something cool!",
30+
"Code, collaborate, create!",
31+
"Happy coding!",
32+
"Ideas become reality here!",
33+
"Let's get productive!",
34+
"Let's turn ideas into code!"
35+
];
36+
37+
// Select a random message when component mounts
38+
const randomMessage = useMemo(() => {
39+
const randomIndex = Math.floor(Math.random() * logoMessages.length);
40+
return logoMessages[randomIndex];
41+
}, []);
42+
2443
useEffect(() => {
2544
capture("auth_modal_shown");
45+
46+
// Load GitHub buttons script
47+
const script = document.createElement('script');
48+
script.src = 'https://buttons.github.io/buttons.js';
49+
script.async = true;
50+
script.defer = true;
51+
document.body.appendChild(script);
52+
53+
return () => {
54+
// Clean up script when component unmounts
55+
if (document.body.contains(script)) {
56+
document.body.removeChild(script);
57+
}
58+
};
2659
}, []);
2760

2861
useEffect(() => {
@@ -54,7 +87,6 @@ export const AuthDialog = ({
5487
// Prepare the content for the Dialog
5588
const dialogContent = (
5689
<div className="auth-modal__content">
57-
5890
<p className="auth-modal__description">{description}</p>
5991

6092
{/* Sign-in buttons */}
@@ -88,46 +120,55 @@ export const AuthDialog = ({
88120

89121
{/* Footer */}
90122
<div className="auth-modal__footer">
91-
<a href="https://discord.com/invite/NnXSESxWpA" className="auth-modal__footer-link" target="_blank" rel="noopener noreferrer">
92-
<DiscordIcon />
93-
</a>
94-
|
95-
<a href="https://github.com/pad-ws/pad.ws" className="auth-modal__footer-link" target="_blank" rel="noopener noreferrer">
96-
<GithubIcon />
97-
</a>
98-
|
99-
<a href="mailto:contact@pad.ws" className="auth-modal__footer-link" target="_blank" rel="noopener noreferrer">
100-
<Mail size={20} />
123+
{/* Warning message */}
124+
<div className="auth-modal__warning">
125+
{warningText}
126+
</div>
127+
128+
{/* GitHub Star button */}
129+
<a className="github-button"
130+
href="https://github.com/pad-ws/pad.ws"
131+
data-color-scheme="no-preference: dark_dimmed; light: dark_dimmed; dark: dark_dimmed;"
132+
data-icon="octicon-star"
133+
data-size="large"
134+
data-show-count="true"
135+
aria-label="Star pad-ws/pad.ws on GitHub">
136+
Star
101137
</a>
138+
139+
102140
</div>
103141

104-
{/* Warning message */}
105-
<div className="auth-modal__warning">
106-
{warningText}
107-
</div>
108142
</div>
109143
);
110144

111145
return (
112146
<>
113147
{modalIsShown && (
114-
<Dialog
115-
className="auth-modal"
116-
size="small"
117-
onCloseRequest={handleClose}
118-
title={
119-
<div id="modal-title" className="auth-modal__title-container">
120-
{/* <img
121-
src="/assets/images/favicon.png"
122-
alt="pad.ws logo"
123-
className="auth-modal__logo"
124-
/> */}
125-
<h2 className="auth-modal__title">pad<span className="auth-modal__title-dot">.ws</span></h2>
148+
<div className="auth-modal__wrapper">
149+
<div className="auth-modal__logo-container">
150+
<img
151+
src="/assets/images/favicon.png"
152+
alt="pad.ws logo"
153+
className="auth-modal__logo"
154+
/>
155+
<div className="auth-modal__logo-speech-bubble">
156+
{randomMessage}
126157
</div>
127-
}
128-
closeOnClickOutside={false}
129-
children={children || dialogContent}
130-
/>
158+
</div>
159+
<Dialog
160+
className="auth-modal"
161+
size="small"
162+
onCloseRequest={handleClose}
163+
title={
164+
<div id="modal-title" className="auth-modal__title-container">
165+
<h2 className="auth-modal__title">pad<span className="auth-modal__title-dot">.ws</span></h2>
166+
</div>
167+
}
168+
closeOnClickOutside={false}
169+
children={children || dialogContent}
170+
/>
171+
</div>
131172
)}
132173
</>
133174
);

0 commit comments

Comments
 (0)