Skip to content

Commit a2f3a22

Browse files
committed
Additional CTA when there are less than two homepage sponsors.
1 parent cc713a1 commit a2f3a22

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed

FrontEnd/styles/home.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,14 @@ body.home {
7171
}
7272
}
7373
}
74+
75+
.ccta-availability {
76+
padding: 10px;
77+
font-size: 13px;
78+
background-color: var(--panel-button-background);
79+
80+
.support {
81+
margin: 0 0 5px;
82+
font-weight: bold;
83+
}
84+
}

Sources/App/Core/ExternalURL.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,30 @@
1515
import Plot
1616

1717
enum ExternalURL: URLRepresentable {
18+
case addNewPackage(_ owner: String, _ repository: String)
19+
case contactMailto
1820
case mastodon
21+
case podcast
1922
case projectGitHub
2023
case projectSponsorship
2124
case raiseNewIssue
22-
case podcast
23-
case addNewPackage(_ owner: String, _ repository: String)
24-
2525

2626
var description: String {
2727
switch(self) {
28+
case let .addNewPackage(owner, repository):
29+
return "https://github.com/SwiftPackageIndex/PackageList/issues/new?labels=Add+Package&template=add_package.yml&title=Add+\(repository)&list=https%3A%2F%2Fgithub.com%2F\(owner)%2F\(repository).git"
30+
case .contactMailto:
31+
return "mailto:[email protected]"
2832
case .mastodon:
2933
return "https://mas.to/@SwiftPackageIndex"
34+
case .podcast:
35+
return "https://swiftpackageindexing.transistor.fm"
3036
case .projectGitHub:
3137
return "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server"
3238
case .projectSponsorship:
3339
return "https://github.com/sponsors/SwiftPackageIndex"
3440
case .raiseNewIssue:
3541
return "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/new/choose"
36-
case .podcast:
37-
return "https://swiftpackageindexing.transistor.fm"
38-
case let .addNewPackage(owner, repository):
39-
return "https://github.com/SwiftPackageIndex/PackageList/issues/new?labels=Add+Package&template=add_package.yml&title=Add+\(repository)&list=https%3A%2F%2Fgithub.com%2F\(owner)%2F\(repository).git"
4042
}
4143
}
4244
}

Sources/App/Views/Home/HomeIndex+View.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,20 @@ enum HomeIndex {
109109
analyticsEvent: "Home - Supporters CTA"),
110110
.group(
111111
Supporters.corporate.shuffled().map(\.advertisementNode)
112-
)
112+
),
113+
.if(Supporters.corporate.count < 2, .div(
114+
.class("ccta-availability"),
115+
.p(
116+
.class("support"),
117+
.text("Support the Swift Package Index")
118+
),
119+
.text("We currently have availability for one additional homepage sponsor. "),
120+
.a(
121+
.href(ExternalURL.contactMailto),
122+
.text("Get in touch for details")
123+
),
124+
.text(".")
125+
))
113126
)
114127
}
115128

0 commit comments

Comments
 (0)