Skip to content

Commit

Permalink
Merge pull request #63 from sqrl-planner/develop
Browse files Browse the repository at this point in the history
Redesign dashboard and add Heap
  • Loading branch information
eamonma authored Jun 20, 2022
2 parents 257230f + 71c69ff commit 59bef73
Show file tree
Hide file tree
Showing 17 changed files with 470 additions and 182 deletions.
2 changes: 2 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
NEXT_PUBLIC_API_URI=http://localhost:8000/graphql
NEXT_PUBLIC_HEAP_ID=0000000000
GITHUB_API_KEY="SAMPLE_KEY"

38 changes: 19 additions & 19 deletions components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const Header = ({ setSidebarOpen }: { setSidebarOpen: any }) => {

onOpenSettings()
router.replace({
query: {...routerQuery}
query: { ...routerQuery },
})
}, [onOpenSettings, router])

Expand Down Expand Up @@ -172,24 +172,24 @@ const Header = ({ setSidebarOpen }: { setSidebarOpen: any }) => {
<HeaderComponent bg={useColorModeValue("gray.75", "gray.700")}>
<AboutModal isOpen={isAboutOpen} onClose={onCloseAbout} />
<ShareModal isOpen={isShareOpen} onClose={onCloseShare} />
<Flex alignItems="center">
{
<Heading
m={4}
ml={6}
as="h1"
fontSize={{ base: "3xl", md: "4xl" }}
position="relative"
>
<Link href="/">
<a>
<Box w={20} h={10}>
<Image src={SqrlLogo} layout="fill" objectFit="contain" />
</Box>
</a>
</Link>
</Heading>
}
<Flex alignItems="center" pl="10rem">
{/* { */}
{/* <Heading */}
{/* m={4} */}
{/* ml={6} */}
{/* as="h1" */}
{/* fontSize={{ base: "3xl", md: "4xl" }} */}
{/* position="relative" */}
{/* > */}
{/* <Link href="/"> */}
{/* <a> */}
{/* <Box as={motion.div} layoutId="sqrl-logo" position="relative" key="sqrl-logo" w={20} h={10}> */}
{/* <Image src={SqrlLogo} layout="fill" objectFit="contain" /> */}
{/* </Box> */}
{/* </a> */}
{/* </Link> */}
{/* </Heading> */}
{/* } */}

<Editable
display="flex"
Expand Down
3 changes: 2 additions & 1 deletion components/sidebar/CourseView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ const CourseView = ({ setSearchQuery }: { setSearchQuery: Function }) => {
const { onCopy, hasCopied } = useClipboard(shareUrl)

useEffect(() => {
if (!course || !userMeetings || !identifier || !userMeetings[identifier]) return
if (!course || !userMeetings || !identifier || !userMeetings[identifier])
return

const missing = meetingsMissing(course, userMeetings, identifier)

Expand Down
2 changes: 1 addition & 1 deletion components/sidebar/SearchView/SearchViewHints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const SearchViewHints = ({ setSearchQuery, debouncedZero }: Props) => {
const { t } = useTranslation(["common", "sidebar"])

return (
<FormHelperText
<FormHelperText
mt={3}
display="flex"
alignItems="center"
Expand Down
2 changes: 1 addition & 1 deletion components/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const Sidebar = () => {
onChange={(index) => {
dispatch({ type: "SET_SIDEBAR", payload: index })

if(index === 1) return
if (index === 1) return

const course = courses[sidebarCourse]

Expand Down
10 changes: 6 additions & 4 deletions components/timetable/MeetingComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Flex, Tooltip } from "@chakra-ui/react"
import React from "react"
import styled from "styled-components"
import styled, { CSSProperties } from "styled-components"
import { usePreferences } from "../../src/PreferencesContext"
import { capitalize } from "../../src/utils/misc"
import { minuteOffsetToTime } from "../../src/utils/time"
Expand All @@ -12,6 +12,7 @@ interface MeetingProps {
meeting: Meeting
darkText?: boolean
twentyFour: boolean
style?: CSSProperties
}

const deliveryAbbreviations: {
Expand Down Expand Up @@ -68,7 +69,7 @@ const MeetingInformation = styled.div<{ darkText: boolean }>`
color: ${({ darkText }) => {
return darkText ? `#111` : `#eee`
}};
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
/* transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1); */
display: flex;
flex-direction: column;
align-content: flex-start;
Expand All @@ -85,7 +86,7 @@ const MeetingTimes = styled.div`
font-size: 0.9em;
line-height: 1em;
opacity: 0.8;
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
/* transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1); */
`

const MeetingDelivery = styled.div``
Expand All @@ -111,6 +112,7 @@ const MeetingComponent = ({
meeting,
darkText = true,
twentyFour,
style,
}: MeetingProps) => {
const {
state: {
Expand All @@ -132,7 +134,7 @@ const MeetingComponent = ({
const { t } = useTranslation("common")

return (
<MeetingInformation darkText={darkText}>
<MeetingInformation style={style} darkText={darkText}>
<MeetingTitle>
{department + "\u200b"}
<div>{numeral + "\u200b"}</div>
Expand Down
4 changes: 2 additions & 2 deletions components/timetable/StyledTimetable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ export const MeetingTime = styled.div<{
}
padding-right: 0.3em;
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1),
box-shadow 0s cubic-bezier(0.645, 0.045, 0.355, 1);
/* transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1), */
/* box-shadow 0s cubic-bezier(0.645, 0.045, 0.355, 1); */
background-color: ${({ courseKey = 0, palette, dark }) =>
courseKeyToColour(courseKey, dark, palettes[palette] as any)};
Expand Down
78 changes: 50 additions & 28 deletions components/timetable/Timetable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type Props = {
* The days of the week to include on the timetable.
*/
days?: Day[]
abstract?: boolean
}

export const Timetable = ({
Expand All @@ -85,6 +86,7 @@ export const Timetable = ({
dark = false,
emphasizeOnHover = true,
days = WEEK_DAYS,
abstract = false,
}: Props) => {
const {
state: { hoverCourseKey },
Expand Down Expand Up @@ -122,7 +124,7 @@ export const Timetable = ({
const timeLabel = minuteOffsetToTime(currentTime, twentyFour)
const cells = [
<StyledTimeLabelTd key={currentTime} className="time">
{timeLabel}
{!abstract && timeLabel}
</StyledTimeLabelTd>,
]

Expand Down Expand Up @@ -211,13 +213,16 @@ export const Timetable = ({
: "",
cursor: meeting.identifier === sidebarCourse ? "default" : "",
opacity: shouldDim ? "0.3" : "",
borderRadius: abstract ? "0.8rem" : "",
}}
>
<MeetingComponent
darkText={!dark}
meeting={meeting}
twentyFour={twentyFour}
/>
{!abstract && (
<MeetingComponent
darkText={!dark}
meeting={meeting}
twentyFour={twentyFour}
/>
)}
</MeetingTime>
</MeetingTimeCell>
)
Expand Down Expand Up @@ -274,7 +279,7 @@ export const Timetable = ({
}% + 0.1rem)`,
backgroundColor:
highlightConflicts &&
// meeting.identifier !== sidebarCourse &&
meeting.identifier !== sidebarCourse &&
(!(hoverCourseKey === meeting.courseKey) ||
!emphasizeOnHover) &&
!(
Expand All @@ -297,6 +302,7 @@ export const Timetable = ({
: "",
cursor: meeting.identifier === sidebarCourse ? "default" : "",
opacity: shouldDim ? "0.3" : "",
borderRadius: abstract ? "0.8rem" : "",
}}
courseKey={meeting.courseKey}
palette={palette}
Expand All @@ -323,21 +329,33 @@ export const Timetable = ({
})
}}
>
<MeetingComponent
darkText={
!(dark || highlightConflicts) ||
(emphasizeOnHover &&
hoverCourseKey === meeting.courseKey &&
!dark) ||
(meeting.identifier === hoverMeeting.courseIdentifier &&
hoverMeeting.meeting.substring(0, 3) ===
meeting.category.substring(0, 3).toUpperCase() &&
!dark)
// || meeting.identifier === sidebarCourse
}
meeting={meeting}
twentyFour={twentyFour}
/>
{!abstract && (
<MeetingComponent
style={{
color: !dark
? hoverCourseKey === meeting.courseKey &&
emphasizeOnHover
? "black"
: meeting.identifier === sidebarCourse
? "black"
: "white"
: "white",
}}
darkText={
!(dark || highlightConflicts) ||
(emphasizeOnHover &&
hoverCourseKey === meeting.courseKey &&
!dark) ||
(meeting.identifier === hoverMeeting.courseIdentifier &&
hoverMeeting.meeting.substring(0, 3) ===
meeting.category.substring(0, 3).toUpperCase() &&
!dark)
// || meeting.identifier === sidebarCourse
}
meeting={meeting}
twentyFour={twentyFour}
/>
)}
</MeetingTime>
)
})
Expand Down Expand Up @@ -376,12 +394,16 @@ export const Timetable = ({
<StyledTimetable>
<StyledThead dark={dark}>
<StyledHead>
<StyledTh dark={dark}></StyledTh>
{days.map((day, index) => (
<StyledTh key={index} dark={dark}>
{t(day.toString().substr(0, 3).toLowerCase())}
</StyledTh>
))}
{!abstract && (
<React.Fragment>
<StyledTh dark={dark}></StyledTh>
{days.map((day, index) => (
<StyledTh key={index} dark={dark}>
{t(day.toString().substr(0, 3).toLowerCase())}
</StyledTh>
))}
</React.Fragment>
)}
</StyledHead>
</StyledThead>
<StyledTbody>{tableRows}</StyledTbody>
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"color": "^4.0.1",
"cross-fetch": "^3.1.5",
"framer-motion": "^6.3.11",
"fuse.js": "^6.6.2",
"graphql": "^15.5.1",
"next": "^12.0.8",
"next-i18next": "^11.0.0",
Expand Down
Loading

0 comments on commit 59bef73

Please sign in to comment.