Skip to content

Commit

Permalink
Merge pull request #1163 from keynmol/improve-landing-page
Browse files Browse the repository at this point in the history
Improve landing page - topic cloud, SJS/SN/scala highlights
  • Loading branch information
adpi2 authored Aug 8, 2023
2 parents c1aa8a5 + 32807bf commit e9e5d4c
Show file tree
Hide file tree
Showing 15 changed files with 361 additions and 389 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ lazy val server = project
),
fork := true,
Compile / run / javaOptions ++= (infra / Compile / run / javaOptions).value,
reStart / javaOptions ++= (infra / Compile / run / javaOptions).value,
Test / javaOptions ++= (infra / javaOptions).value,
Defaults.itSettings,
IntegrationTest / javaOptions ++= (infra / Compile / run / javaOptions).value
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package scaladex.core.model

final case class TopicCount(topic: String, count: Int)

object TopicCount {
implicit val ordering: Ordering[TopicCount] = Ordering.by(_.topic)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import scaladex.core.model.Category
import scaladex.core.model.Language
import scaladex.core.model.Platform
import scaladex.core.model.Project
import scaladex.core.model.TopicCount
import scaladex.core.model.search.AwesomeParams
import scaladex.core.model.search.Page
import scaladex.core.model.search.PageParams
Expand All @@ -21,7 +22,7 @@ trait SearchEngine {

// Front page
def count(): Future[Int]
def countByTopics(limit: Int): Future[Seq[(String, Int)]]
def countByTopics(limit: Int): Future[Seq[TopicCount]]
def countByLanguages(): Future[Seq[(Language, Int)]]
def countByPlatforms(): Future[Seq[(Platform, Int)]]
def getMostDependedUpon(limit: Int): Future[Seq[ProjectDocument]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import scaladex.core.model.Category
import scaladex.core.model.Language
import scaladex.core.model.Platform
import scaladex.core.model.Project
import scaladex.core.model.TopicCount
import scaladex.core.model.search.AwesomeParams
import scaladex.core.model.search.Page
import scaladex.core.model.search.PageParams
Expand All @@ -33,7 +34,7 @@ class InMemorySearchEngine extends SearchEngine {

override def countByPlatforms(): Future[Seq[(Platform, Int)]] = ???

override def countByTopics(limit: Int): Future[Seq[(String, Int)]] = ???
override def countByTopics(limit: Int): Future[Seq[TopicCount]] = ???

override def getMostDependedUpon(limit: Int): Future[Seq[ProjectDocument]] = ???

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import scaladex.core.model.GithubIssue
import scaladex.core.model.Language
import scaladex.core.model.Platform
import scaladex.core.model.Project
import scaladex.core.model.TopicCount
import scaladex.core.model.search.AwesomeParams
import scaladex.core.model.search.Page
import scaladex.core.model.search.PageParams
Expand Down Expand Up @@ -128,9 +129,9 @@ class ElasticsearchEngine(esClient: ElasticClient, index: String)(implicit ec: E
esClient.execute(request).map(_.result.totalHits.toInt)
}

override def countByTopics(limit: Int): Future[Seq[(String, Int)]] =
override def countByTopics(limit: Int): Future[Seq[TopicCount]] =
countAllUnique("githubInfo.topics.keyword", matchAllQuery(), limit)
.map(_.sortBy(_._1))
.map(_.map { case (topic, count) => TopicCount(topic, count) }.sorted)

def countByLanguages(): Future[Seq[(Language, Int)]] =
languageAggregation(matchAllQuery())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import scaladex.core.model.Project
import scaladex.core.model.Scala
import scaladex.core.model.ScalaJs
import scaladex.core.model.ScalaNative
import scaladex.core.model.TopicCount
import scaladex.core.model.search.GithubInfoDocument
import scaladex.core.model.search.PageParams
import scaladex.core.model.search.ProjectDocument
Expand Down Expand Up @@ -93,7 +94,7 @@ class ElasticsearchEngineTests extends AsyncFreeSpec with Matchers with BeforeAn
}

"count by topics" in {
val expected = Scalafix.githubInfo.topics.toSeq.sorted.map(_ -> 1L)
val expected = Scalafix.githubInfo.topics.toSeq.sorted.map(TopicCount(_, 1))
for {
_ <- insertAll(projects)
topics <- searchEngine.countByTopics(10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@
'partials/github',
'partials/awesome',
'partials/project',
'partials/admin';
'partials/admin',
'partials/frontpage';

165 changes: 165 additions & 0 deletions modules/server/src/main/assets/css/partials/_frontpage.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
// Home page
// -----------------------------------------------------------------------------
#container-home {
.home-search {
background: url('/assets/img/head-project-background.png') no-repeat center top #0D343C;
padding: 80px 0 100px 0;
h1 {
font-size: 42px;
color: #fff;
text-align: center;
margin: 24px 0;
}
.has-feedback {
.autocomplete {
ul {
li {
padding: 0;
a {
display: block;
padding: 15px;
p {
font-size: ($font-size-base * 1.3);
}
}
}
}
}
.form-control {
font-size: 20px;
min-height: 60px;
padding-left: 60px;
}
.form-control-feedback {
font-size: 20px;
height: 60px;
width: 60px;
padding-top: 10px;
}
}
}
.topic {
padding: 0;
margin-top: 10px;
margin-bottom: 24px;
text-align: center;
li {
list-style: none;
display: inline-block;
a {
color: $gray-lighter;
text-decoration: none;
padding: 0 4px 0 8px;
&:hover,
&:focus {
color: $brand-primary;
text-decoration: underline;
}
}
.super-count {
vertical-align: super;
color: $gray-light;
font-size: small;
}
}
}
.ecosystem-row {
h3 {
font-size: large;
text-align: center;
font-weight: bold;
color: $gray-light;
margin-top: 24px;
}
}
.ecosystem-badge {
text-align: center;
a {
&:hover,
&:focus {
text-decoration: none;
h4 {
color: $brand-primary;
}
}
}
h4 {
margin: 18px 0 0 0;
color: white;
font-size: x-large;
font-weight: bold;

}
p {
color: $gray-lighter;
margin: 0;
}
.badge-other-versions {
a {
padding-left: 5px;
color: white;
text-decoration: underline;
&:hover,
&:focus {
color: $brand-primary
}
}
}
}
.recent-projects {
padding: 40px 0 80px 0;
h2 {
margin-bottom: ($line-height-computed * 1.5);
}
a {
h4 {
font-size: 16px;
}
p,
span {
color: $gray;
}
&:hover,
&:focus {
text-decoration: none;
h4 {
color: $brand-primary;
text-decoration: underline;
}
}
}
}
.content-project {
&.box {
padding: 10px;
}
height: 186px;
margin-bottom: 30px;
.content-project-header {
& > img,
& > h4 {
display: inline-block;
vertical-align: middle;
}
border-bottom: 1px solid rgba($gray-dark, 0.12);
padding-bottom: 20px;
margin-bottom: 20px;
h4 {
margin: 0;
display: inline-block;
padding-left: 15px;
width: 90%;
}
img {
width: 28px;
height: auto;
float: left;
}
}
.content-project-body {}
&:hover,
&:focus {
@include box-shadow(0 1px 15px rgba(0, 0, 0, 0.15));
}
}
}
1 change: 0 additions & 1 deletion modules/server/src/main/assets/css/partials/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//display: none;
width: 100%;
background: #fff;
top: 42px;
left: 0;
position: absolute;
z-index: 9999;
Expand Down
Loading

0 comments on commit e9e5d4c

Please sign in to comment.