Skip to content

Commit 47caab6

Browse files
committed
add search screen
1 parent 1f17d34 commit 47caab6

File tree

13 files changed

+688
-110
lines changed

13 files changed

+688
-110
lines changed

desktopApp/src/main/composeResources/values/strings.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,9 @@
212212
<string name="settings_about_localization">Crowdin</string>
213213
<string name="settings_about_localization_description">Help us translate Flare</string>
214214
<string name="settings_privacy_policy">Privacy Policy</string>
215+
216+
<string name="users">Users</string>
217+
<string name="hashtags">Hashtags</string>
218+
<string name="statues">Statuses</string>
219+
215220
</resources>

desktopApp/src/main/kotlin/dev/dimension/flare/App.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ internal fun FlareApp(
136136
.onSuccess { user ->
137137
SubtleButton(
138138
onClick = {
139+
navigate(MeRoute(AccountType.Specific(user.key)))
139140
},
140141
) {
141142
Column(
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package dev.dimension.flare.ui.component
2+
3+
import androidx.compose.foundation.layout.padding
4+
import androidx.compose.runtime.Composable
5+
import androidx.compose.ui.Modifier
6+
import androidx.compose.ui.unit.dp
7+
import io.github.composefluent.FluentTheme
8+
import io.github.composefluent.component.Text
9+
10+
@Composable
11+
fun Header(text: String) {
12+
Text(
13+
text = text,
14+
style = FluentTheme.typography.bodyStrong,
15+
modifier = Modifier.padding(top = 16.dp, bottom = 4.dp),
16+
)
17+
}

desktopApp/src/main/kotlin/dev/dimension/flare/ui/route/Route.kt

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ internal sealed interface Route {
3939
val userKey: MicroBlogKey,
4040
) : ScreenRoute
4141

42+
@Serializable
43+
data class ProfileWithNameAndHost(
44+
val accountType: AccountType,
45+
val userName: String,
46+
val host: String,
47+
) : ScreenRoute
48+
4249
@Serializable
4350
data class MeRoute(
4451
val accountType: AccountType,
@@ -119,6 +126,12 @@ internal sealed interface Route {
119126
val text: String,
120127
) : FloatingRoute
121128

129+
@Serializable
130+
data class Search(
131+
val accountType: AccountType,
132+
val keyword: String,
133+
) : ScreenRoute
134+
122135
companion object {
123136
public fun parse(url: String): Route? {
124137
val data = Url(url)
@@ -140,8 +153,7 @@ internal sealed interface Route {
140153
val keyword = data.segments.getOrNull(0) ?: return null
141154
val accountType =
142155
accountKey?.let { AccountType.Specific(it) } ?: AccountType.Guest
143-
// Route.Search(accountType, keyword)
144-
null
156+
Route.Search(accountType = accountType, keyword = keyword)
145157
}
146158

147159
"Profile" -> {
@@ -158,8 +170,11 @@ internal sealed interface Route {
158170
val host = data.segments.getOrNull(1) ?: return null
159171
val accountType =
160172
accountKey?.let { AccountType.Specific(it) } ?: AccountType.Guest
161-
// Route.Profile.UserNameWithHost(accountType, userName, host)
162-
null
173+
Route.ProfileWithNameAndHost(
174+
accountType = accountType,
175+
userName = userName,
176+
host = host,
177+
)
163178
}
164179

165180
"StatusDetail" -> {
@@ -246,13 +261,19 @@ internal sealed interface Route {
246261
"DeleteStatus" -> {
247262
val accountKey = MicroBlogKey.valueOf(data.segments.getOrNull(0) ?: return null)
248263
val statusKey = MicroBlogKey.valueOf(data.segments.getOrNull(1) ?: return null)
249-
Route.DeleteStatus(statusKey = statusKey, accountType = AccountType.Specific(accountKey))
264+
Route.DeleteStatus(
265+
statusKey = statusKey,
266+
accountType = AccountType.Specific(accountKey),
267+
)
250268
}
251269

252270
"AddReaction" -> {
253271
val accountKey = MicroBlogKey.valueOf(data.segments.getOrNull(0) ?: return null)
254272
val statusKey = MicroBlogKey.valueOf(data.segments.getOrNull(1) ?: return null)
255-
Route.AddReaction(statusKey = statusKey, accountType = AccountType.Specific(accountKey))
273+
Route.AddReaction(
274+
statusKey = statusKey,
275+
accountType = AccountType.Specific(accountKey),
276+
)
256277
}
257278

258279
"Bluesky" ->
@@ -262,7 +283,10 @@ internal sealed interface Route {
262283
MicroBlogKey.valueOf(data.segments.getOrNull(1) ?: return null)
263284
val statusKey =
264285
MicroBlogKey.valueOf(data.segments.getOrNull(2) ?: return null)
265-
Route.BlueskyReport(statusKey = statusKey, accountType = AccountType.Specific(accountKey))
286+
Route.BlueskyReport(
287+
statusKey = statusKey,
288+
accountType = AccountType.Specific(accountKey),
289+
)
266290
}
267291

268292
else -> null

desktopApp/src/main/kotlin/dev/dimension/flare/ui/route/Router.kt

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import androidx.compose.ui.ExperimentalComposeUiApi
77
import androidx.compose.ui.Modifier
88
import androidx.compose.ui.unit.dp
99
import dev.dimension.flare.data.model.Bluesky.FeedTabItem
10-
import dev.dimension.flare.data.model.IconType
1110
import dev.dimension.flare.data.model.IconType.Material
1211
import dev.dimension.flare.data.model.ListTimelineTabItem
1312
import dev.dimension.flare.data.model.TabMetaData
@@ -17,6 +16,8 @@ import dev.dimension.flare.ui.screen.feeds.FeedListScreen
1716
import dev.dimension.flare.ui.screen.home.DiscoverScreen
1817
import dev.dimension.flare.ui.screen.home.NotificationScreen
1918
import dev.dimension.flare.ui.screen.home.ProfileScreen
19+
import dev.dimension.flare.ui.screen.home.ProfileWithUserNameAndHostDeeplinkRoute
20+
import dev.dimension.flare.ui.screen.home.SearchScreen
2021
import dev.dimension.flare.ui.screen.home.TimelineScreen
2122
import dev.dimension.flare.ui.screen.list.AllListScreen
2223
import dev.dimension.flare.ui.screen.serviceselect.ServiceSelectScreen
@@ -66,7 +67,7 @@ internal fun Router(
6667
metaData =
6768
TabMetaData(
6869
title = TitleType.Text(it.title),
69-
icon = Material(IconType.Material.MaterialIcon.List),
70+
icon = Material(Material.MaterialIcon.List),
7071
),
7172
),
7273
),
@@ -87,7 +88,7 @@ internal fun Router(
8788
metaData =
8889
TabMetaData(
8990
title = TitleType.Text(it.title),
90-
icon = Material(IconType.Material.MaterialIcon.Feeds),
91+
icon = Material(Material.MaterialIcon.Feeds),
9192
),
9293
),
9394
),
@@ -103,6 +104,37 @@ internal fun Router(
103104
is Route.Discover -> {
104105
DiscoverScreen(
105106
accountType = route.accountType,
107+
toUser = {
108+
navigate(
109+
Route.Profile(
110+
accountType = route.accountType,
111+
userKey = it,
112+
),
113+
)
114+
},
115+
toSearch = {
116+
navigate(
117+
Route.Search(
118+
accountType = route.accountType,
119+
keyword = it,
120+
),
121+
)
122+
},
123+
)
124+
}
125+
126+
is Route.Search -> {
127+
SearchScreen(
128+
initialQuery = route.keyword,
129+
accountType = route.accountType,
130+
toUser = {
131+
navigate(
132+
Route.Profile(
133+
accountType = route.accountType,
134+
userKey = it,
135+
),
136+
)
137+
},
106138
)
107139
}
108140

@@ -148,7 +180,7 @@ internal fun Router(
148180
)
149181
}
150182

151-
is Route.Timeline -> {
183+
is Timeline -> {
152184
TimelineScreen(
153185
route.tabItem,
154186
)
@@ -160,18 +192,34 @@ internal fun Router(
160192
accountType = route.accountType,
161193
)
162194
}
195+
163196
is Route.VVO.CommentDetail -> {
164197
VVOCommentScreen(
165198
commentKey = route.statusKey,
166199
accountType = route.accountType,
167200
)
168201
}
202+
169203
is Route.VVO.StatusDetail -> {
170204
VVOStatusScreen(
171205
statusKey = route.statusKey,
172206
accountType = route.accountType,
173207
)
174208
}
209+
210+
is Route.ProfileWithNameAndHost -> {
211+
ProfileWithUserNameAndHostDeeplinkRoute(
212+
userName = route.userName,
213+
host = route.host,
214+
accountType = route.accountType,
215+
onBack = ::onBack,
216+
toEditAccountList = {},
217+
toSearchUserUsingAccount = { _, _ -> },
218+
toStartMessage = {},
219+
onFollowListClick = {},
220+
onFansListClick = {},
221+
)
222+
}
175223
}
176224
}
177225
}
@@ -186,20 +234,23 @@ internal fun Router(
186234
onBack = ::onBack,
187235
)
188236
}
237+
189238
is Route.BlueskyReport -> {
190239
BlueskyReportStatusDialog(
191240
accountType = entry.route.accountType,
192241
statusKey = entry.route.statusKey,
193242
onBack = ::onBack,
194243
)
195244
}
245+
196246
is Route.DeleteStatus -> {
197247
DeleteStatusConfirmDialog(
198248
accountType = entry.route.accountType,
199249
statusKey = entry.route.statusKey,
200250
onBack = ::onBack,
201251
)
202252
}
253+
203254
is Route.MastodonReport -> {
204255
MastodonReportDialog(
205256
accountType = entry.route.accountType,
@@ -208,6 +259,7 @@ internal fun Router(
208259
userKey = entry.route.userKey,
209260
)
210261
}
262+
211263
is Route.MisskeyReport -> {
212264
MisskeyReportDialog(
213265
accountType = entry.route.accountType,

desktopApp/src/main/kotlin/dev/dimension/flare/ui/screen/feeds/FeedListScreen.kt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@ import dev.dimension.flare.model.AccountType
2525
import dev.dimension.flare.ui.common.items
2626
import dev.dimension.flare.ui.common.plus
2727
import dev.dimension.flare.ui.component.FAIcon
28+
import dev.dimension.flare.ui.component.Header
2829
import dev.dimension.flare.ui.component.UiListItem
29-
import dev.dimension.flare.ui.component.platform.PlatformListItem
3030
import dev.dimension.flare.ui.component.status.StatusPlaceholder
3131
import dev.dimension.flare.ui.component.uiListItemComponent
3232
import dev.dimension.flare.ui.model.UiList
3333
import dev.dimension.flare.ui.presenter.home.bluesky.BlueskyFeedsPresenter
3434
import dev.dimension.flare.ui.presenter.invoke
3535
import dev.dimension.flare.ui.theme.screenHorizontalPadding
3636
import io.github.composefluent.component.SubtleButton
37-
import io.github.composefluent.component.Text
3837
import moe.tlaster.precompose.molecule.producePresenter
3938
import org.jetbrains.compose.resources.stringResource
4039

@@ -64,23 +63,15 @@ internal fun FeedListScreen(
6463
verticalArrangement = Arrangement.spacedBy(2.dp),
6564
) {
6665
item {
67-
PlatformListItem(
68-
headlineContent = {
69-
Text(stringResource(Res.string.feeds_my_feeds_title))
70-
},
71-
)
66+
Header(stringResource(Res.string.feeds_my_feeds_title))
7267
}
7368
uiListItemComponent(
7469
state.myFeeds,
7570
onClicked = toFeed,
7671
)
7772

7873
item {
79-
PlatformListItem(
80-
headlineContent = {
81-
Text(stringResource(Res.string.feeds_discover_feeds_title))
82-
},
83-
)
74+
Header(stringResource(Res.string.feeds_discover_feeds_title))
8475
}
8576
items(
8677
state.popularFeeds,

0 commit comments

Comments
 (0)