-
Notifications
You must be signed in to change notification settings - Fork 0
glimpse-GM-Timeline5 #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Created env file with the url and anon key - Created lib folder with supabase.ts with the necessary supabase info - Created tailwind.config.js file and changed configuration in babel.config.js
…hted. There is no button functionality as of yet to look at past entries
…hted. There is no button functionality as of yet to look at past entries
…/Glimpse-Mobile into glimpse-GM-Timeline5
…/Glimpse-Mobile into glimpse-GM-Timeline5
AndrewCheung360
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work Jason, the timeline component looks amazing!
I think the main thing that we might want to change is replacing the index number displayed in the circles with the actual date of the month which I think should be easily achievable with javascript's Date object.
Other than that, there's some minor CSS/design changes I highlighted in some other comments that you can choose to change or not.
Something to consider possibly in the future is to allow users to view previous prompts and responses of the week using the timeline by selecting the circle of a previous day in the week.
|
Not sure if this will affect anything, but I think it's better to be safe than sorry: I see that the env file does not appear to be in the files changed which is good, but is it possible for you to delete the .env file from the commit history of this branch? I don't know if people might be able to see the contents of the env file by looking into the commit history of this branch. |
|
Looks good! |
…ont changes and Date object changes
|
Ok I was able to go in and adjust those minor changes! |
|
Hi Jason, I see that you have made those changes with the actual dates being shown instead of the indices, which is great! I didn't check for the other days, but there might be an edge case for Sunday which causes the component logic to skip to the next week. eg. today is 7/14 but the component shows the dates of next week. |
components/Timeline.tsx
Outdated
| // *Constants | ||
| const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; | ||
| const today = new Date(); | ||
| const todayIndex = today.getDay() - 1; // getDay() returns 0 for Sunday, 1 for Monday, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue may potentially lie in todayIndex being -1 on Sunday, so firstDayOfWeek would result in today.getDate + 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
const today = new Date();
const todayIndex = today.getDay()
This is a potential fix that would result in Sunday being the first day of the week, so it depends on which day we want to display as the first day of the week between Sunday or Monday
| todayIndex === index ? "border border-[#5731D6]" : "bg-white" | ||
| }`} | ||
| > | ||
| <Text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// *Imports
import React from "react";
import { Text, View, StyleSheet } from "react-native";
import { LinearGradient } from 'expo-linear-gradient';
import MaskedView from "@react-native-masked-view/masked-view";
// *Constants
const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
const today = new Date();
const todayIndex = today.getDay();
// *Start of the Timeline Function
export default function Timeline() {
const firstDayOfWeek = new Date(today);
firstDayOfWeek.setDate(today.getDate() - todayIndex);
return (
<View style={styles.container}>
{days.map((day, index) => {
const dayDate = new Date(firstDayOfWeek);
dayDate.setDate(firstDayOfWeek.getDate() + index);
const dateNumber = dayDate.getDate();
return (
<View key={index} style={styles.dayContainer}>
<Text style={styles.dayText}>{day}</Text>
<View
style={[
styles.circle,
todayIndex === index && styles.activeBorder,
]}
>
{todayIndex === index ? (
<MaskedView
style={styles.maskedView}
maskElement={
<View style={styles.centerText}>
<Text style={styles.maskedText}>{dateNumber}</Text>
</View>
}
>
<LinearGradient
colors={["#D372E5", "#5731D6"]}
start={{ x: 0, y: 0 }}
end={{ x: 1, y: 1 }}
style={styles.gradient}
/>
</MaskedView>
) : (
<Text style={styles.defaultText}>{dateNumber}</Text>
)}
</View>
</View>
);
})}
</View>
);
}
const styles = StyleSheet.create({
container: {
flexDirection: "row",
alignItems: "center",
gap: 12,
// justifyContent: "space-around",
},
dayContainer: {
flexDirection: "column",
alignItems: "center",
},
dayText: {
marginBottom: 8,
fontWeight: "600",
},
circle: {
width: 40,
height: 40,
borderRadius: 20,
alignItems: "center",
justifyContent: "center",
backgroundColor: "white",
shadowColor: "#gray",
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowRadius: 2,
},
activeBorder: {
borderWidth: 2,
borderColor: "#5731D6",
},
maskedView: {
width: "100%",
height: "100%",
alignItems: "center",
justifyContent: "center",
},
gradient: {
width: 40,
height: 40,
},
centerText: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
maskedText: {
fontSize: 16,
fontWeight: "bold",
textAlign: "center",
color: "black",
},
defaultText: {
fontSize: 16,
fontWeight: "bold",
textAlign: "center",
color: "black",
},
});
I found something called MaskedView, which would allow us to have gradient text. For the border, you could probably just add a linear gradient circle behind the selected circle. Here's some example code for the timeline with just the text change. Not sure if you still want to pursue gradient colored text, but it might be worth looking into if we ever have gradient text components/UI in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that there does seem to be some sort of thing where the circle becomes transparent for the selected day in the little code snippet I pasted, but hopefully when actually used, we could try to fix that
| const todayIndex = today.getDay(); | ||
|
|
||
| // *Start of the Timeline Function | ||
| export default function Timeline() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is included in the component feature, but thinking ahead, we could potentially have a selected state and onSelectedStateChange being passed with the default state being that which corresponds to the current date, but when the user clicks into a previous bubble, they would select a new day which would allow them to view the previous feeds.
AndrewCheung360
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The component looks and works great! I didn't have anything I saw that needed fixing, but I just placed some comments about some things we could think about in the future.

Created Timeline component that displays the days of the week in a horizontal row, highlighting the current day.
Key Features:
Accessibility enhancements.
There was a slight change in the gitignore in order to prevent envs from being pushed.