Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add "card" post layout #680

Merged
merged 6 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@
<string name="timeline_entry_in_reply_to">in reply to</string>
<string name="timeline_entry_reblogged_by">re-shared by</string>
<string name="timeline_local">Local</string>
<string name="timeline_layout_card">Card</string>
<string name="timeline_layout_compact">Compact</string>
<string name="timeline_layout_distraction_free">Distraction free</string>
<string name="timeline_layout_full">Full</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ import raccoonforfriendica.composeapp.generated.resources.time_second_short
import raccoonforfriendica.composeapp.generated.resources.timeline_all
import raccoonforfriendica.composeapp.generated.resources.timeline_entry_in_reply_to
import raccoonforfriendica.composeapp.generated.resources.timeline_entry_reblogged_by
import raccoonforfriendica.composeapp.generated.resources.timeline_layout_card
import raccoonforfriendica.composeapp.generated.resources.timeline_layout_compact
import raccoonforfriendica.composeapp.generated.resources.timeline_layout_distraction_free
import raccoonforfriendica.composeapp.generated.resources.timeline_layout_full
Expand Down Expand Up @@ -1212,6 +1213,8 @@ class SharedStrings : Strings {
@Composable get() = stringResource(Res.string.timeline_entry_in_reply_to)
override val timelineEntryRebloggedBy: String
@Composable get() = stringResource(Res.string.timeline_entry_reblogged_by)
override val timelineLayoutCard: String
@Composable get() = stringResource(Res.string.timeline_layout_card)
override val timelineLayoutCompact: String
@Composable get() = stringResource(Res.string.timeline_layout_compact)
override val timelineLayoutDistractionFree: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ enum class TimelineLayout {
Full,
DistractionFree,
Compact,
Card,
}

fun TimelineLayout.toInt(): Int =
when (this) {
TimelineLayout.DistractionFree -> 1
TimelineLayout.Compact -> 2
TimelineLayout.Card -> 3
else -> 0
}

fun Int.toTimelineLayout(): TimelineLayout =
when (this) {
1 -> TimelineLayout.DistractionFree
2 -> TimelineLayout.Compact
3 -> TimelineLayout.Card
else -> TimelineLayout.Full
}

Expand All @@ -29,4 +32,5 @@ fun TimelineLayout.toReadableName(): String =
TimelineLayout.Full -> LocalStrings.current.timelineLayoutFull
TimelineLayout.DistractionFree -> LocalStrings.current.timelineLayoutDistractionFree
TimelineLayout.Compact -> LocalStrings.current.timelineLayoutCompact
TimelineLayout.Card -> LocalStrings.current.timelineLayoutCard
}
Loading
Loading