-
Notifications
You must be signed in to change notification settings - Fork 3
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
[timeline] fix display of unit above #142
Merged
Merged
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a551ddf
fix: 🐛 [Timeline] Fixed display for month unit
luciob 3f5415d
refactor: 💡 [Timeline] Currently switch back to start/end unit
luciob ea9a047
fix: 🐛 [Timeline] Print unit above of length = rowHeight
luciob 703f12c
refactor: 💡 [Timeline] Changed calculation of above blocks
luciob f67d077
fix: 🐛 [TimeLine] Fixed display of unit above
CrisGrud 1761c2c
Merge branch 'main' of https://github.com/melfore/konva-timeline into…
CrisGrud 02c81d9
fix: 🐛 [timeLine] fixed start interval for week unit
CrisGrud 6f7b7b0
fix: 🐛 [TimeLine] fixed display unitAbove when TZ change
CrisGrud d6f31e5
fix: 🐛 [TimeLine] Fixed display of visibleTimeBlock with Tz
CrisGrud 9e8d987
refactor: 💡 Code refactored
CrisGrud 982e645
refactor: 💡 Added type for HourInfo and DayInfo
CrisGrud a134be6
refactor: 💡 Code refacotring
CrisGrud def605c
refactor: 💡 Code refactoring
CrisGrud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { Interval } from "luxon"; | ||
|
||
import { daysInMonth, getMonth, getStartMonthsDay, getYear, Scale } from "../../utils/time-resolution"; | ||
|
||
interface VisibleHourInfoProps { | ||
backHour?: boolean; | ||
nextHour?: boolean; | ||
} | ||
|
||
interface DayDetailProps { | ||
thisMonth?: number; | ||
untilNow?: number; | ||
} | ||
|
||
export const timeBlockTz = (timeBlock: Interval[], initialTz?: string) => { | ||
const dayInfoArray: VisibleHourInfoProps[] = []; | ||
timeBlock.forEach((column) => { | ||
const tzStart = column.start!.toISO()?.slice(-6); | ||
|
||
if (initialTz !== tzStart) { | ||
if (Number(initialTz?.slice(1, 3)) - Number(tzStart!.slice(1, 3)) > 0) { | ||
dayInfoArray.push({ | ||
backHour: true, | ||
nextHour: false, | ||
}); | ||
return; | ||
} | ||
dayInfoArray.push({ | ||
backHour: false, | ||
nextHour: true, | ||
}); | ||
} | ||
dayInfoArray.push({ | ||
backHour: false, | ||
nextHour: false, | ||
}); | ||
return; | ||
}); | ||
return dayInfoArray; | ||
}; | ||
|
||
export const dayDetail = (unitAbove: Scale, aboveTimeBlocks: Interval[], interval: Interval) => { | ||
if (unitAbove === "month") { | ||
const dayInfo: DayDetailProps[] = []; | ||
aboveTimeBlocks.forEach((column, index) => { | ||
const month = getMonth(column); | ||
const year = getYear(column); | ||
const currentMonthDays = daysInMonth(Number(month), Number(year)); | ||
if (index === 0) { | ||
const startDay = getStartMonthsDay(interval.start!); | ||
const daysToMonthEnd = currentMonthDays - Number(startDay) + 1; | ||
dayInfo.push({ | ||
thisMonth: daysToMonthEnd, | ||
untilNow: daysToMonthEnd, | ||
}); | ||
return; | ||
} | ||
const n = dayInfo[index - 1].untilNow! + currentMonthDays; | ||
|
||
dayInfo.push({ | ||
thisMonth: currentMonthDays, | ||
untilNow: n, | ||
}); | ||
}); | ||
return dayInfo; | ||
} | ||
return []; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Remove
logError
call or switch tologDebug
, or delete