Skip to content

Commit

Permalink
Additional CTA when there are less than two homepage sponsors.
Browse files Browse the repository at this point in the history
  • Loading branch information
daveverwer committed Jan 20, 2025
1 parent cc713a1 commit a2f3a22
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
11 changes: 11 additions & 0 deletions FrontEnd/styles/home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,14 @@ body.home {
}
}
}

.ccta-availability {
padding: 10px;
font-size: 13px;
background-color: var(--panel-button-background);

.support {
margin: 0 0 5px;
font-weight: bold;
}
}
16 changes: 9 additions & 7 deletions Sources/App/Core/ExternalURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,30 @@
import Plot

enum ExternalURL: URLRepresentable {
case addNewPackage(_ owner: String, _ repository: String)
case contactMailto
case mastodon
case podcast
case projectGitHub
case projectSponsorship
case raiseNewIssue
case podcast
case addNewPackage(_ owner: String, _ repository: String)


var description: String {
switch(self) {
case let .addNewPackage(owner, repository):
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"
case .contactMailto:
return "mailto:[email protected]"
case .mastodon:
return "https://mas.to/@SwiftPackageIndex"
case .podcast:
return "https://swiftpackageindexing.transistor.fm"
case .projectGitHub:
return "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server"
case .projectSponsorship:
return "https://github.com/sponsors/SwiftPackageIndex"
case .raiseNewIssue:
return "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/new/choose"
case .podcast:
return "https://swiftpackageindexing.transistor.fm"
case let .addNewPackage(owner, repository):
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"
}
}
}
15 changes: 14 additions & 1 deletion Sources/App/Views/Home/HomeIndex+View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,20 @@ enum HomeIndex {
analyticsEvent: "Home - Supporters CTA"),
.group(
Supporters.corporate.shuffled().map(\.advertisementNode)
)
),
.if(Supporters.corporate.count < 2, .div(
.class("ccta-availability"),
.p(
.class("support"),
.text("Support the Swift Package Index")
),
.text("We currently have availability for one additional homepage sponsor. "),
.a(
.href(ExternalURL.contactMailto),
.text("Get in touch for details")
),
.text(".")
))
)
}

Expand Down

0 comments on commit a2f3a22

Please sign in to comment.