Skip to content

Commit

Permalink
fix: 🐛 fix no data ui
Browse files Browse the repository at this point in the history
  • Loading branch information
yeukfei02 committed Feb 16, 2023
1 parent eba9acd commit 719a3b7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 24 deletions.
34 changes: 22 additions & 12 deletions src/components/busArrivalTime/BusArrivalTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,30 @@ function BusArrivalTime() {
if (!loading) {
if (!_.isEmpty(busArrivalTime)) {
busArrivalTimeView = busArrivalTime.map((item, i) => {
return (
<View key={i}>
<Card style={styles.cardContainer}>
<Card.Title
title={`${t("next")} ${item.eta_seq || i + 1} ${t("bus")}`}
/>
<Card.Content>
<Title>
{t("remainingTime")} {getMinutesDiffStr(item.eta)}
</Title>
if (item.eta_seq && item.eta) {
return (
<View key={i}>
<Card style={styles.cardContainer}>
<Card.Title
title={`${t("next")} ${item.eta_seq || i + 1} ${t("bus")}`}
/>
<Card.Content>
<Title>
{t("remainingTime")} {getMinutesDiffStr(item.eta)}
</Title>
</Card.Content>
</Card>
</View>
);
} else {
return (
<Card key={i} style={styles.cardContainer}>
<Card.Content style={{ alignSelf: "center" }}>
<Title style={{ color: "red" }}>{t("noData")}</Title>
</Card.Content>
</Card>
</View>
);
);
}
});
} else {
busArrivalTimeView = (
Expand Down
34 changes: 22 additions & 12 deletions src/components/busStopArrivalTime/BusStopArrivalTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,30 @@ function BusStopArrivalTime() {
busStopArrivalTimeView = Object.entries(busStopArrivalTime).map(
([key, value], i) => {
const valueListView = value.map((item, i) => {
return (
<View key={i}>
<Card style={styles.cardContainer}>
<Card.Title
title={`${t("next")} ${item.eta_seq} ${t("bus")}`}
/>
<Card.Content>
<Title>
{t("remainingTime")} {getMinutesDiffStr(item.eta)}
</Title>
if (item.eta_seq && item.eta) {
return (
<View key={i}>
<Card style={styles.cardContainer}>
<Card.Title
title={`${t("next")} ${item.eta_seq} ${t("bus")}`}
/>
<Card.Content>
<Title>
{t("remainingTime")} {getMinutesDiffStr(item.eta)}
</Title>
</Card.Content>
</Card>
</View>
);
} else {
return (
<Card key={i} style={styles.cardContainer}>
<Card.Content style={{ alignSelf: "center" }}>
<Title style={{ color: "red" }}>{t("noData")}</Title>
</Card.Content>
</Card>
</View>
);
);
}
});

const view = (
Expand Down

0 comments on commit 719a3b7

Please sign in to comment.