Skip to content

Commit 8981513

Browse files
committed
Fix sponsor page copy-paste and drop nested GetAQuote modal
- Guard card/overlay click handlers against text selections so drag-select no longer triggers navigation (copy-paste now works end-to-end). - Drop the nested GetAQuote modal: convert it to a standalone page reached via a real <Link>, fixing the broken href and stacked-overlay UX. - Preserve the ?category filter across modal open/close. - Fix ProgressBar fill overlapping the rounded track ends (overflow hidden). - Fix modal scrollbar overlapping the rounded corners (overflow hidden on dialog content, drop redundant inner border-radius).
1 parent 145fcf2 commit 8981513

8 files changed

Lines changed: 45 additions & 69 deletions

File tree

src/components/about/styles.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
box-shadow: var(--ifm-shadow-dialog);
1919
border-radius: 20px;
2020
z-index: 4000;
21+
overflow: hidden;
2122
}
2223

2324
.small_portrait_card {

src/components/fundable/FundableProjectCard.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ export default function FundableProjectCard({ project }) {
77
const history = useHistory();
88

99
function open() {
10+
if (window.getSelection()?.toString()) return;
11+
const category = new URLSearchParams(window.location.search).get("category");
12+
const search = category ? `?category=${encodeURIComponent(category)}` : "";
1013
history.push({
1114
pathname: `/sponsor/${project.pageName}`,
15+
search,
1216
state: { fromFundable: true, scrollY: window.scrollY },
1317
});
1418
}

src/components/fundable/GetAQuotePage.tsx

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
import styles from "./styles.module.css";
33
import GetAQuoteForm from "./GetAQuoteForm"
44
import { LargeProjectCardContent } from "./LargeProjectCard";
5-
import { useHistory, useLocation } from "@docusaurus/router";
5+
import { useHistory } from "@docusaurus/router";
66
import Layout from "@theme/Layout";
77
import { Route } from 'react-router-dom';
88
import { getCategoryFromProjectPageName } from ".";
9-
import { FundableContent as FundableProjects } from "@site/src/pages/sponsor";
109

1110
function GetAQuoteComponent({ project }) {
1211
return (
@@ -28,16 +27,13 @@ function GetAQuoteComponent({ project }) {
2827
)
2928
}
3029
export default function GetAQuotePage() {
31-
const location = useLocation();
3230
const history = useHistory();
3331

3432
const handleClose = () => {
35-
history.push('/sponsor');
36-
33+
history.goBack();
3734
}
3835
return (
3936
<Layout>
40-
<FundableProjects />
4137
<Route
4238
path="/sponsor/:pageName/GetAQuote"
4339
render={({ match }) => {
@@ -47,22 +43,17 @@ export default function GetAQuotePage() {
4743
if (!project) return null;
4844

4945
return (
50-
<div className={styles.project_dialog_overlay} >
51-
<div
52-
className={styles.project_dialog_content}
53-
onClick={(e) => e.stopPropagation()}
54-
>
55-
<button
56-
className="close-button"
57-
style={{
58-
position: "absolute",
59-
top: "10px",
60-
right: "10px",
61-
}}
62-
onClick={handleClose}
63-
/>
64-
<GetAQuoteComponent project={project} />
65-
</div>
46+
<div className={styles.get_a_quote_page}>
47+
<button
48+
className="close-button"
49+
style={{
50+
position: "absolute",
51+
top: "10px",
52+
right: "10px",
53+
}}
54+
onClick={handleClose}
55+
/>
56+
<GetAQuoteComponent project={project} />
6657
</div>
6758
);
6859
}}

src/components/fundable/LargeProjectCard.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
11
import styles from "./styles.module.css";
22
import React from "react";
33
import LinkToGetAQuote from "./LinkToGetAQuote";
4-
import { useHistory, useLocation } from "@docusaurus/router";
54

65
export function LargeProjectCardContent({ project }) {
7-
const history = useHistory();
8-
const location = useLocation();
9-
10-
function openDialog() {
11-
const pageName = project.pageName;
12-
13-
history.push({
14-
pathname: `/sponsor/${pageName}/GetAQuote`,
15-
state: { from: location.pathname, scrollY: window.scrollY },
16-
});
17-
}
186
return (
19-
<div className={"container"} onClick={openDialog}>
7+
<div className={"container"}>
208
<div className={"row-padding-none"}>
219
<div className="col col--12">
2210
<div className={styles.large_project_card_title}>{project.title}</div>

src/components/fundable/LargeProjectCardPage.tsx

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ import { FundableContent } from "@site/src/pages/sponsor";
88
import styles from "@site/src/components/about/styles.module.css";
99
import LargeProjectCard from './LargeProjectCard';
1010

11+
function backToOverview(history, scrollY) {
12+
const category = new URLSearchParams(window.location.search).get("category");
13+
const search = category ? `?category=${encodeURIComponent(category)}` : "";
14+
history.replace({ pathname: '/sponsor', search });
15+
if (scrollY !== undefined) {
16+
setTimeout(() => window.scrollTo({ top: scrollY, behavior: 'auto' }), 0);
17+
}
18+
}
19+
1120
export default function LargeProjectCardPage() {
1221
const location = useLocation();
1322
const history = useHistory();
@@ -18,26 +27,15 @@ export default function LargeProjectCardPage() {
1827
}
1928
}, []);
2029

21-
const handleOverlayClick = () => {
22-
const scrollY = location.state?.scrollY;
23-
setTimeout(() => {
24-
if (scrollY !== undefined) {
25-
window.scrollTo({ top: scrollY, behavior: 'auto' });
26-
}
27-
}, 0);
28-
history.replace('/sponsor');
30+
const handleOverlayClick = (e) => {
31+
if (window.getSelection()?.toString()) return;
32+
if (e.target !== e.currentTarget) return;
33+
backToOverview(history, location.state?.scrollY);
2934
};
3035

3136
const handleClose = () => {
32-
const scrollY = location.state?.scrollY;
3337
if (location.state?.fromFundable) {
34-
history.replace('/sponsor');
35-
36-
setTimeout(() => {
37-
if (scrollY !== undefined) {
38-
window.scrollTo({ top: scrollY, behavior: 'auto' });
39-
}
40-
}, 0);
38+
backToOverview(history, location.state?.scrollY);
4139
} else {
4240
history.goBack();
4341
}

src/components/fundable/LinkToGetAQuote.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default function LinkToGetAQuote({ label, pageName }) {
66
<div className="flex-full-centered">
77
<Link
88
className={"link-to-button" + " " + styles.link_to_get_a_quote}
9-
href={'/sponsor'}
9+
to={`/sponsor/${pageName}/GetAQuote`}
1010
>
1111
{label}
1212
</Link>

src/components/fundable/ProgressBar.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ export default function ProgressBar({ value = 0, color = '#4caf50' }) {
99
border: 'solid 0.5px',
1010
height: '21px',
1111
width: '190px',
12+
overflow: 'hidden',
1213
}}>
1314

1415
<div style={{
1516
width: `${value}%`,
1617
background: color,
17-
border: 'solid 0.5px',
1818
height: '100%',
19-
borderRadius: '16px',
2019
transition: 'width 0.3s ease-in-out',
2120
}} />
2221
</div>

src/components/fundable/styles.module.css

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,13 @@
212212
justify-content: center;
213213
}
214214

215+
.get_a_quote_page {
216+
position: relative;
217+
max-width: 1200px;
218+
margin: 0 auto;
219+
padding: var(--ifm-spacing-3xl) var(--ifm-spacing-xl);
220+
}
221+
215222
.form_label {
216223
font-size: 12px;
217224
color: var(--ifm-text-color);
@@ -378,7 +385,6 @@
378385
.large_project_card {
379386
width: 90vw;
380387
padding: var(--ifm-spacing-xl);
381-
border-radius: 8px;
382388
padding: var(--ifm-spacing-xl) var(--ifm-spacing-xl);
383389
overflow-y: auto;
384390
max-height: 95vh;
@@ -412,10 +418,7 @@
412418

413419

414420
.get_a_quote_dialog {
415-
width: 90vw;
416-
padding: 40px;
417-
overflow-y: auto;
418-
max-height: 95vh;
421+
padding: var(--ifm-spacing-md);
419422
}
420423

421424
.get_a_quote_text_col_desktop {
@@ -452,7 +455,6 @@
452455
.large_project_card {
453456
width: 80vw;
454457
padding: 40px;
455-
border-radius: 8px;
456458
padding: var(--ifm-spacing-xl) var(--ifm-spacing-xl);
457459
overflow-y: auto;
458460
max-height: 95vh;
@@ -481,10 +483,7 @@
481483
}
482484

483485
.get_a_quote_dialog {
484-
width: 80vw;
485-
padding: 40px;
486-
overflow-y: auto;
487-
max-height: 95vh;
486+
padding: var(--ifm-spacing-lg);
488487
}
489488

490489
.get_a_quote_text_col_desktop {
@@ -522,7 +521,6 @@
522521
.large_project_card {
523522
width: 800px;
524523
padding: 40px;
525-
border-radius: 8px;
526524
overflow-y: auto;
527525
max-height: 95vh;
528526
}
@@ -555,10 +553,7 @@
555553
}
556554

557555
.get_a_quote_dialog {
558-
width: 90vw;
559-
padding: 40px;
560-
overflow-y: auto;
561-
max-height: 95vh;
556+
padding: var(--ifm-spacing-xl);
562557
}
563558

564559
.get_a_quote_form_col_mobile {

0 commit comments

Comments
 (0)