Skip to content

Commit 2a53ce4

Browse files
committed
added back bikram fixed events parsing. handling events for holiday too.
1 parent 5fa3f33 commit 2a53ce4

File tree

5 files changed

+321
-145
lines changed

5 files changed

+321
-145
lines changed

qml/CalendarGrid.qml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ ColumnLayout {
2828
Layout.preferredHeight: parent.width
2929
Layout.margins: 10
3030
Layout.topMargin: 10
31-
//Layout.bottomMargin: 10
3231

3332
Repeater {
3433
id: repeater
@@ -60,6 +59,18 @@ ColumnLayout {
6059
item.isSaturday = modelData.isSaturday;
6160
item.hasEvent = modelData.hasEvent;
6261
item.theme = calendarGridRoot.theme;
62+
63+
var isHoliday = false;
64+
if (modelData.panchanga && modelData.panchanga.events) {
65+
for (var i = 0; i < modelData.panchanga.events.length; i++) {
66+
if (modelData.panchanga.events[i].holiday) {
67+
isHoliday = true;
68+
break;
69+
}
70+
}
71+
}
72+
item.isHoliday = isHoliday;
73+
6374
item.clicked.connect(function() {
6475
calendarGridRoot.dayClicked(modelData.panchanga)
6576
});
@@ -78,7 +89,6 @@ ColumnLayout {
7889
Rectangle {
7990
id: eventFooter
8091
Layout.fillWidth: true
81-
//Layout.topMargin: 10
8292
implicitHeight: eventLabel.paintedHeight + 20
8393
color: theme.secondaryBg
8494
radius: 6
@@ -91,15 +101,14 @@ ColumnLayout {
91101

92102
property var eventModel: [] // Model reference
93103

94-
// Bind the text property to a function that builds the string
95104
text: {
96105
var str = "";
97106
if (eventModel) {
98107
for (var i = 0; i < eventModel.length; i++) {
99108
var item = eventModel[i];
100109
str += item.bsDay + " :\u00A0" + item.eventName;
101110
if (i < eventModel.length - 1) {
102-
str += " ";
111+
str += "  •  ";
103112
}
104113
}
105114
}

qml/DayCell.qml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ Rectangle {
1313
property bool isToday: false
1414
property bool isSaturday: false
1515
property bool hasEvent: false
16+
property bool isHoliday: false
1617
property var theme
18+
property var cellDate
1719

1820
signal clicked()
1921

2022
color: {
2123
if (!theme) return "white";
2224
if (cellMouseArea.containsMouse) return theme.tertiaryBg;
25+
//holiday background disabled now
26+
//if (isHoliday) return theme.holidayBg;
2327
if (isSaturday) return theme.saturdayBg;
2428
if (isToday) return theme.todayBg;
2529
return theme.secondaryBg;
@@ -29,10 +33,26 @@ Rectangle {
2933
if (!theme) return "grey";
3034
if (isToday) return theme.todayBorder;
3135
if (isSaturday) return theme.saturdayBorder;
36+
if (isHoliday) return theme.holidayBorder;
3237
return theme.borderColor;
3338
}
3439
border.width: isToday ? 2 : 1
3540

41+
Component.onCompleted: {
42+
if (cellDate) {
43+
var dayInfo = Panchanga.calculate(cellDate);
44+
if (dayInfo.events && dayInfo.events.length > 0) {
45+
for (var i = 0; i < dayInfo.events.length; i++) {
46+
if (dayInfo.events[i].holiday) {
47+
isHoliday = true;
48+
break;
49+
}
50+
}
51+
}
52+
}
53+
}
54+
55+
3656
// Event Indicator
3757
Rectangle {
3858
id: eventIndicator

qml/Theme.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ QtObject {
3535
readonly property color borderColor: isDark ? "#334155" : "#e2e8f0"
3636
readonly property color todayBorder: isDark ? "#0ea5e9" : "#0284c7"
3737
readonly property color saturdayBorder: isDark ? "#334155" : "#fda4af"
38+
readonly property color holidayBorder: isDark ? "#334155" : "#fda4af"
3839

3940
// === Highlighted Days ===
4041
readonly property color todayBg: isDark ? "#082f49" : "#f0f9ff"
4142
readonly property color saturdayBg: isDark ? "#6E3233" : "#FEDDDF"
43+
//readonly property color holidayBg: isDark ? "#6E3233" : "#FEDDDF"
4244
readonly property color adDayText: isDark ? "#BBCFFA" : "#6E9BFD"
4345

4446
// === Modal / Dialogs ===

0 commit comments

Comments
 (0)