Skip to content

Commit 1c748bb

Browse files
authored
Merge pull request #340 from OpenHub-Store/filter-platform
2 parents cc768fa + 166879f commit 1c748bb

27 files changed

Lines changed: 628 additions & 179 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package zed.rainxch.core.domain.model
2+
3+
enum class DiscoveryPlatform {
4+
All,
5+
Android,
6+
Macos,
7+
Windows,
8+
Linux,
9+
}

core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/model/GithubRepoSummary.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ data class GithubRepoSummary(
1818
val releasesUrl: String,
1919
val updatedAt: String,
2020
val isFork: Boolean = false,
21-
val availablePlatforms: List<String> = emptyList(),
21+
val availablePlatforms: List<DiscoveryPlatform> = emptyList(),
2222
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="32dp"
3+
android:height="32dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24">
6+
<path
7+
android:pathData="M18.447,4.106C18.941,4.353 19.141,4.953 18.894,5.447L17.72,7.796C20.307,9.604 22,12.604 22,16L22,17C22,18.105 21.105,19 20,19L4,19C2.895,19 2,18.105 2,17L2,16C2,12.604 3.693,9.604 6.28,7.796L5.106,5.447C4.859,4.953 5.059,4.353 5.553,4.106C6.047,3.859 6.647,4.059 6.894,4.553L8.028,6.82C9.246,6.292 10.589,6 12,6C13.411,6 14.755,6.292 15.972,6.82L17.106,4.553C17.353,4.059 17.953,3.859 18.447,4.106ZM7.5,12C6.672,12 6,12.672 6,13.5C6,14.328 6.672,15 7.5,15C8.328,15 9,14.328 9,13.5C9,12.672 8.328,12 7.5,12ZM16.5,12C15.672,12 15,12.672 15,13.5C15,14.328 15.672,15 16.5,15C17.328,15 18,14.328 18,13.5C18,12.672 17.328,12 16.5,12Z"
8+
android:strokeWidth="1"
9+
android:fillColor="#008d40"
10+
android:fillType="evenOdd"
11+
android:strokeColor="#00000000"/>
12+
</vector>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="32dp" android:viewportHeight="32" android:viewportWidth="32" android:width="32dp">
2+
3+
<path android:fillColor="#000000" android:pathData="M15.6,8.1c0,0.1 -0.1,0.1 -0.1,0.1h-0.1c-0.1,0 -0.1,-0.1 -0.2,-0.2 0,0 -0.1,-0.1 -0.1,-0.2s0,-0.1 0.1,-0.1l0.2,0.1c0.1,0.1 0.2,0.2 0.2,0.3m-1.9,-1c0,-0.5 -0.2,-0.8 -0.5,-0.8 0,0 0,0.1 -0.1,0.1v0.2h0.3c0,0.2 0.1,0.3 0.1,0.5h0.2m3.6,-0.5c0.2,0 0.3,0.2 0.4,0.5h0.2c-0.1,-0.1 -0.1,-0.2 -0.1,-0.3 0,-0.1 0,-0.2 -0.1,-0.3 -0.1,-0.1 -0.2,-0.2 -0.3,-0.2 0,0 -0.1,0.1 -0.2,0.1 0,0.1 0.1,0.1 0.1,0.2m-3.1,1.6c-0.1,0 -0.1,0 -0.1,-0.1s0,-0.2 0.1,-0.3c0.2,0 0.3,-0.1 0.3,-0.1 0.1,0 0.1,0.1 0.1,0.1 0,0.1 -0.1,0.2 -0.3,0.4h-0.1m-1.1,-0.1c-0.4,-0.2 -0.5,-0.5 -0.5,-1 0,-0.3 0,-0.5 0.2,-0.7 0.1,-0.2 0.3,-0.3 0.5,-0.3s0.3,0.1 0.5,0.3c0.1,0.3 0.2,0.6 0.2,0.9v0.2h0.1v-0.1c0.1,0 0.1,-0.2 0.1,-0.6 0,-0.3 0,-0.6 -0.2,-0.9 -0.2,-0.3 -0.4,-0.5 -0.8,-0.5 -0.3,0 -0.6,0.2 -0.7,0.5 -0.2,0.4 -0.2,0.7 -0.2,1.2 0,0.4 0.1,0.8 0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0.4 0.3,-0.9 0.3,-1.3 0,-0.2 -0.1,-0.8 -0.2,-1.8s-0.2,-2.1 -0.2,-3c0,-0.7 0.1,-1.2 0.2,-1.7s0.4,-1 0.7,-1.4c0.3,-0.4 0.7,-0.8 1.3,-1 0.6,-0.2 1.3,-0.3 2.2,-0.3 0.3,0 0.6,0 0.9,0.1 0.3,0 0.7,0.1 1.2,0.3 0.4,0.2 0.8,0.4 1.1,0.7 0.2,0.2 0.6,0.7 0.9,1.2 0.2,0.6 0.4,1.2 0.5,2.1 0.1,0.5 0.1,1 0.2,1.7 0,0.6 0.1,1 0.1,1.3 0.1,0.3 0.1,0.7 0.2,1.2 0.1,0.4 0.2,0.8 0.4,1.1 0.2,0.4 0.4,0.8 0.7,1.2 0.3,0.5 0.7,1 1.1,1.6 0.9,1 1.6,2.2 2.1,3.3 0.5,1 0.8,2.4 0.8,3.8 0,0.7 -0.1,1.4 -0.3,2.1 0.2,0 0.3,0.1 0.4,0.2s0.2,0.5 0.3,0.9l0.1,0.8c0.1,0.2 0.2,0.4 0.5,0.6 0.2,0.2 0.4,0.3 0.7,0.5 0.2,0.1 0.5,0.2 0.7,0.4 0.2,0.2 0.3,0.4 0.3,0.6 0,0.3 -0.1,0.6 -0.3,0.8 -0.2,0.2 -0.4,0.3 -0.7,0.4l-1.2,0.6c-0.5,0.3 -1,0.7 -1.5,1.1l-1,0.9c-0.4,0.4 -0.8,0.7 -1.1,0.9 -0.3,0.2 -0.7,0.3 -1.1,0.3l-0.7,-0.1c-0.8,-0.2 -1.3,-0.6 -1.6,-1.3 -1.8,0 -3.1,-0.1 -3.9,-0.1"/>
4+
5+
</vector>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="32dp" android:viewportHeight="32" android:viewportWidth="32" android:width="32dp">
2+
3+
<path android:fillColor="#000000" android:pathData="M25.658,17.49c0.052,1.257 1.082,2.032 2.649,2.032 1.65,0 2.688,-0.812 2.688,-2.107 0,-1.016 -0.586,-1.587 -1.969,-1.903l-0.784,-0.18c-0.837,-0.197 -1.181,-0.462 -1.181,-0.916 0,-0.566 0.519,-0.945 1.29,-0.945 0.779,0 1.312,0.382 1.37,1.021h1.162c-0.029,-1.2 -1.021,-2.012 -2.523,-2.012 -1.483,0 -2.537,0.816 -2.537,2.024 0,0.975 0.596,1.578 1.852,1.867l0.884,0.207c0.86,0.204 1.208,0.487 1.208,0.977 0,0.567 -0.571,0.973 -1.393,0.973 -0.831,0 -1.458,-0.411 -1.535,-1.04zM21.932,13.518c1.213,0 1.988,0.962 1.988,2.484 0,1.516 -0.775,2.479 -1.987,2.479 -1.22,0 -1.989,-0.962 -1.989,-2.479 0,-1.521 0.77,-2.484 1.988,-2.484zM21.932,12.479c-0.032,-0.001 -0.07,-0.002 -0.108,-0.002 -1.74,0 -3.15,1.41 -3.15,3.15 0,0.133 0.008,0.263 0.024,0.391l-0.002,-0.015c-0.014,0.113 -0.022,0.243 -0.022,0.375 0,1.738 1.409,3.146 3.146,3.146 0.04,0 0.079,-0.001 0.119,-0.002l-0.006,0c0.032,0.001 0.07,0.002 0.107,0.002 1.737,0 3.144,-1.408 3.144,-3.144 0,-0.133 -0.008,-0.263 -0.024,-0.392l0.002,0.015c0.014,-0.113 0.023,-0.245 0.023,-0.378 0,-1.739 -1.409,-3.148 -3.148,-3.148 -0.037,0 -0.074,0.001 -0.11,0.002l0.005,-0zM18.301,16.186c-0.087,-1.065 -0.973,-1.896 -2.053,-1.896 -0.059,0 -0.117,0.002 -0.175,0.007l0.008,-0.001c-0.021,-0.001 -0.045,-0.001 -0.07,-0.001 -1.295,0 -2.344,1.05 -2.344,2.344 0,0.093 0.005,0.185 0.016,0.276l-0.001,-0.011c-0.01,0.082 -0.016,0.177 -0.016,0.273 0,1.287 1.043,2.33 2.33,2.33 0.033,0 0.067,-0.001 0.1,-0.002l-0.005,0c0.056,0.006 0.122,0.009 0.188,0.009 1.064,0 1.936,-0.817 2.026,-1.857l0.001,-0.008h-1.11c-0.067,0.515 -0.503,0.908 -1.03,0.908 -0.021,0 -0.043,-0.001 -0.064,-0.002l0.003,0c-0.746,0 -1.227,-0.604 -1.227,-1.652 0,-1.03 0.476,-1.653 1.218,-1.653 0.013,-0.001 0.028,-0.001 0.043,-0.001 0.541,0 0.988,0.406 1.052,0.931l0,0.005zM10.422,19.488c0.009,0 0.019,0 0.03,0 0.649,0 1.217,-0.349 1.525,-0.871l0.005,-0.008h0.022v0.799h1.135v-3.449c0,-1.005 -0.809,-1.662 -2.049,-1.662 -1.276,0 -2.074,0.671 -2.126,1.606h1.091c0.094,-0.4 0.447,-0.693 0.869,-0.693 0.042,0 0.083,0.003 0.123,0.008l-0.005,-0.001c0.58,0 0.935,0.302 0.935,0.827v0.359l-1.322,0.075c-1.22,0.076 -1.904,0.61 -1.904,1.498 0.008,0.84 0.69,1.517 1.531,1.517 0.05,0 0.099,-0.002 0.147,-0.007l-0.006,0zM10.777,18.601c-0.51,0 -0.85,-0.26 -0.85,-0.671 0,-0.397 0.325,-0.652 0.892,-0.69l1.157,-0.071v0.384c-0.034,0.588 -0.519,1.052 -1.112,1.052 -0.031,0 -0.062,-0.001 -0.092,-0.004l0.004,0zM1.004,19.408h1.176v-3.065c-0.002,-0.023 -0.003,-0.049 -0.003,-0.075 0,-0.534 0.432,-0.967 0.966,-0.968h0c0.018,-0.001 0.04,-0.002 0.062,-0.002 0.458,0 0.829,0.371 0.829,0.829 0,0.027 -0.001,0.053 -0.004,0.079l0,-0.003v3.207h1.143v-3.095c-0.002,-0.023 -0.003,-0.049 -0.003,-0.076 0,-0.519 0.42,-0.939 0.939,-0.939 0.007,0 0.013,0 0.02,0l-0.001,-0c0.018,-0.001 0.039,-0.002 0.06,-0.002 0.467,0 0.845,0.378 0.845,0.845 0,0.042 -0.003,0.083 -0.009,0.124l0.001,-0.005v3.147h1.175v-3.434c0.003,-0.034 0.004,-0.074 0.004,-0.114 0,-0.859 -0.696,-1.555 -1.555,-1.555 -0.029,0 -0.058,0.001 -0.086,0.002l0.004,-0c-0.019,-0.001 -0.04,-0.001 -0.062,-0.001 -0.673,0 -1.249,0.412 -1.492,0.996l-0.004,0.011h-0.029c-0.156,-0.585 -0.681,-1.009 -1.305,-1.009 -0.032,0 -0.064,0.001 -0.096,0.003l0.004,-0c-0.014,-0 -0.029,-0.001 -0.045,-0.001 -0.631,0 -1.169,0.397 -1.378,0.954l-0.003,0.01h-0.024v-0.869h-1.128v5.007z"/>
4+
5+
</vector>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="32dp" android:viewportHeight="24" android:viewportWidth="24" android:width="32dp">
2+
3+
<path android:fillColor="#000000" android:pathData="M2,12.5v6.7l8.1,1.2v-7.9M10.1,3.7L2,4.9v6.7h8.1M21.9,11.5V2L11.1,3.6v8M11.1,20.5L21.9,22v-9.5H11.1"/>
4+
5+
</vector>

core/presentation/src/commonMain/kotlin/zed/rainxch/core/presentation/components/RepositoryCard.kt

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,21 @@ import androidx.compose.ui.text.style.TextOverflow
4141
import androidx.compose.ui.tooling.preview.Preview
4242
import androidx.compose.ui.unit.dp
4343
import org.jetbrains.compose.resources.stringResource
44+
import zed.rainxch.core.domain.model.DiscoveryPlatform
4445
import zed.rainxch.core.presentation.model.DiscoveryRepositoryUi
4546
import zed.rainxch.core.presentation.model.GithubRepoSummaryUi
4647
import zed.rainxch.core.presentation.model.GithubUserUi
4748
import zed.rainxch.core.presentation.theme.GithubStoreTheme
4849
import zed.rainxch.core.presentation.utils.formatReleasedAt
4950
import zed.rainxch.core.presentation.utils.hasWeekNotPassed
50-
import zed.rainxch.githubstore.core.presentation.res.*
51+
import zed.rainxch.core.presentation.utils.toIcons
52+
import zed.rainxch.githubstore.core.presentation.res.Res
53+
import zed.rainxch.githubstore.core.presentation.res.forked_repository
54+
import zed.rainxch.githubstore.core.presentation.res.home_view_details
55+
import zed.rainxch.githubstore.core.presentation.res.installed
56+
import zed.rainxch.githubstore.core.presentation.res.open_in_browser
57+
import zed.rainxch.githubstore.core.presentation.res.share_repository
58+
import zed.rainxch.githubstore.core.presentation.res.update_available
5159

5260
@OptIn(ExperimentalMaterial3ExpressiveApi::class, ExperimentalLayoutApi::class)
5361
@Composable
@@ -103,17 +111,20 @@ fun RepositoryCard(
103111
) {
104112
Row(
105113
modifier =
106-
Modifier.clickable(onClick = {
107-
onDeveloperClick(discoveryRepositoryUi.repository.owner.login)
108-
}),
114+
Modifier
115+
.clip(CircleShape)
116+
.clickable(onClick = {
117+
onDeveloperClick(discoveryRepositoryUi.repository.owner.login)
118+
})
119+
.padding(horizontal = 4.dp, vertical = 2.dp),
109120
verticalAlignment = Alignment.CenterVertically,
110121
horizontalArrangement = Arrangement.spacedBy(12.dp),
111122
) {
112123
GitHubStoreImage(
113124
imageModel = { discoveryRepositoryUi.repository.owner.avatarUrl },
114125
modifier =
115126
Modifier
116-
.size(32.dp)
127+
.size(40.dp)
117128
.clip(CircleShape),
118129
)
119130

@@ -128,7 +139,7 @@ fun RepositoryCard(
128139
}
129140

130141
Text(
131-
text = "/ ${discoveryRepositoryUi.repository.name}",
142+
text = "/",
132143
style = MaterialTheme.typography.titleMedium,
133144
color = MaterialTheme.colorScheme.outline,
134145
softWrap = false,
@@ -173,7 +184,7 @@ fun RepositoryCard(
173184
)
174185
}
175186

176-
Spacer(Modifier.height(16.dp))
187+
Spacer(Modifier.height(8.dp))
177188

178189
Row(
179190
modifier = Modifier.fillMaxWidth(),
@@ -231,7 +242,7 @@ fun RepositoryCard(
231242
}
232243
}
233244

234-
Spacer(Modifier.height(12.dp))
245+
Spacer(Modifier.height(8.dp))
235246

236247
val releasedAtText =
237248
buildAnnotatedString {
@@ -251,7 +262,7 @@ fun RepositoryCard(
251262
overflow = TextOverflow.Ellipsis,
252263
)
253264

254-
Spacer(Modifier.height(24.dp))
265+
Spacer(Modifier.height(12.dp))
255266

256267
Row(
257268
modifier = Modifier.fillMaxWidth(),
@@ -303,21 +314,36 @@ fun RepositoryCard(
303314

304315
@Composable
305316
fun PlatformChip(
306-
platform: String,
317+
platform: DiscoveryPlatform,
307318
modifier: Modifier = Modifier,
308319
) {
309320
Surface(
310321
modifier = modifier,
311-
shape = RoundedCornerShape(8.dp),
322+
shape = RoundedCornerShape(16.dp),
312323
color = MaterialTheme.colorScheme.surfaceContainerHighest,
313324
) {
314-
Text(
315-
text = platform,
316-
style = MaterialTheme.typography.labelSmall,
317-
color = MaterialTheme.colorScheme.onSurfaceVariant,
318-
fontWeight = FontWeight.Medium,
319-
modifier = Modifier.padding(horizontal = 8.dp, vertical = 3.dp),
320-
)
325+
FlowRow(
326+
modifier = Modifier.padding(vertical = 4.dp, horizontal = 8.dp),
327+
horizontalArrangement = Arrangement.spacedBy(2.dp),
328+
verticalArrangement = Arrangement.spacedBy(4.dp, Alignment.CenterVertically),
329+
) {
330+
platform.toIcons().forEach { icon ->
331+
Icon(
332+
imageVector = icon,
333+
contentDescription = null,
334+
modifier = Modifier.size(20.dp),
335+
tint = MaterialTheme.colorScheme.onSurface,
336+
)
337+
}
338+
339+
Text(
340+
text = platform.name,
341+
style = MaterialTheme.typography.labelSmall,
342+
color = MaterialTheme.colorScheme.onSurfaceVariant,
343+
fontWeight = FontWeight.Medium,
344+
modifier = Modifier.padding(horizontal = 8.dp, vertical = 3.dp),
345+
)
346+
}
321347
}
322348
}
323349

core/presentation/src/commonMain/kotlin/zed/rainxch/core/presentation/model/GithubRepoSummaryUi.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package zed.rainxch.core.presentation.model
22

33
import kotlinx.collections.immutable.ImmutableList
44
import kotlinx.collections.immutable.persistentListOf
5+
import zed.rainxch.core.domain.model.DiscoveryPlatform
56

67
data class GithubRepoSummaryUi(
78
val id: Long,
@@ -18,5 +19,5 @@ data class GithubRepoSummaryUi(
1819
val releasesUrl: String,
1920
val updatedAt: String,
2021
val isFork: Boolean = false,
21-
val availablePlatforms: ImmutableList<String> = persistentListOf(),
22+
val availablePlatforms: ImmutableList<DiscoveryPlatform> = persistentListOf(),
2223
)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package zed.rainxch.core.presentation.utils
2+
3+
import androidx.compose.runtime.Composable
4+
import androidx.compose.ui.graphics.vector.ImageVector
5+
import org.jetbrains.compose.resources.stringResource
6+
import org.jetbrains.compose.resources.vectorResource
7+
import zed.rainxch.core.domain.model.DiscoveryPlatform
8+
import zed.rainxch.githubstore.core.presentation.res.*
9+
10+
@Composable
11+
fun DiscoveryPlatform.toIcons(): List<ImageVector> =
12+
when (this) {
13+
DiscoveryPlatform.All -> {
14+
listOf(
15+
vectorResource(Res.drawable.ic_platform_android),
16+
vectorResource(Res.drawable.ic_platform_linux),
17+
vectorResource(Res.drawable.ic_platform_macos),
18+
vectorResource(Res.drawable.ic_platform_windows),
19+
)
20+
}
21+
22+
DiscoveryPlatform.Android -> {
23+
listOf(vectorResource(Res.drawable.ic_platform_android))
24+
}
25+
26+
DiscoveryPlatform.Macos -> {
27+
listOf(vectorResource(Res.drawable.ic_platform_macos))
28+
}
29+
30+
DiscoveryPlatform.Windows -> {
31+
listOf(vectorResource(Res.drawable.ic_platform_windows))
32+
}
33+
34+
DiscoveryPlatform.Linux -> {
35+
listOf(vectorResource(Res.drawable.ic_platform_linux))
36+
}
37+
}
38+
39+
@Composable
40+
fun DiscoveryPlatform.toLabel(): String =
41+
when (this) {
42+
DiscoveryPlatform.All -> {
43+
stringResource(Res.string.category_all)
44+
}
45+
46+
DiscoveryPlatform.Android -> {
47+
"Android"
48+
}
49+
50+
DiscoveryPlatform.Macos -> {
51+
"macOS"
52+
}
53+
54+
DiscoveryPlatform.Windows -> {
55+
"Windows"
56+
}
57+
58+
DiscoveryPlatform.Linux -> {
59+
"Linux"
60+
}
61+
}

0 commit comments

Comments
 (0)