git ssb

1+

Daan Patchwork / manyverse



Commit cca51431719e8cb2119e89f1303ad52fc2f7e847

ux: improve the updates indicator for the public tab

Andre Staltz committed on 2/4/2020, 11:52:48 AM
Parent: fe09767f57c90052eddf5dc2c64c6e5caac5154b

Files changed

src/frontend/screens/central/public-tab/model.tschanged
src/frontend/screens/central/styles.tschanged
src/frontend/screens/central/view.tschanged
src/frontend/screens/central/public-tab/model.tsView
@@ -35,18 +35,13 @@
3535 return {...prev, getPublicFeedReadable: getReadable};
3636 },
3737 );
3838
39- const incUpdatesReducer$ = prevState$
40- .filter(s => s.numOfUpdates === 0)
41- .map(() =>
42- ssbSource.publicLiveUpdates$
43- .take(1)
44- .mapTo(function incUpdatesReducer(prev: State): State {
39+ const incUpdatesReducer$ = ssbSource.publicLiveUpdates$.mapTo(
40+ function incUpdatesReducer(prev: State): State {
4541 return {...prev, numOfUpdates: prev.numOfUpdates + 1};
46- }),
47- )
48- .flatten();
42+ },
43+ );
4944
5045 const resetUpdatesReducer$ = actions.resetUpdates$.mapTo(
5146 function resetUpdatesReducer(prev: State): State {
5247 return {...prev, numOfUpdates: 0};
src/frontend/screens/central/styles.tsView
@@ -69,18 +69,30 @@
6969 fontFamily: Typography.fontFamilyReadableText,
7070 textAlign: 'center',
7171 },
7272
73- updatesDot: {
74- backgroundColor: Palette.textForBackgroundBrand,
75- width: 7,
76- height: 7,
73+ updatesCoverAll: {
74+ height: 11,
7775 position: 'absolute',
78- top: -4,
79- right: 1,
80- borderRadius: 4,
76+ top: 8.5,
77+ left: 5,
78+ right: 5,
79+ backgroundColor: Palette.backgroundText,
8180 },
8281
82+ updatesCoverSome: {
83+ height: 11,
84+ position: 'absolute',
85+ top: 8.5,
86+ left: 5,
87+ right: 11,
88+ backgroundColor: Palette.backgroundText,
89+ },
90+
91+ updatesCoverNone: {
92+ display: 'none',
93+ },
94+
8395 syncingProgressBar: {
8496 position: 'absolute',
8597 left: 2,
8698 right: 2,
src/frontend/screens/central/view.tsView
@@ -35,15 +35,29 @@
3535
3636 function renderPublicIcon(numOfPublicUpdates: number) {
3737 return {
3838 normal: h(View, [
39- numOfPublicUpdates > 0 ? h(View, {style: styles.updatesDot}) : null,
4039 h(Icon, {...iconProps.tab, ...iconData.public}),
40+ h(View, {
41+ style:
42+ numOfPublicUpdates > 10
43+ ? styles.updatesCoverNone
44+ : numOfPublicUpdates > 0
45+ ? styles.updatesCoverSome
46+ : styles.updatesCoverAll,
47+ }),
4148 ] as any),
4249
4350 selected: h(View, [
44- numOfPublicUpdates > 0 ? h(View, {style: styles.updatesDot}) : null,
4551 h(Icon, {...iconProps.tabSelected, ...iconData.public}),
52+ h(View, {
53+ style:
54+ numOfPublicUpdates > 10
55+ ? styles.updatesCoverNone
56+ : numOfPublicUpdates > 0
57+ ? styles.updatesCoverSome
58+ : styles.updatesCoverAll,
59+ }),
4660 ] as any),
4761 };
4862 }
4963

Built with git-ssb-web