File size: 1,569 Bytes
6b19fee
 
 
 
8b41187
6b19fee
 
 
f628c0d
6b19fee
 
 
e695e33
 
 
 
 
 
6cce895
c1666a3
6b19fee
 
893ad41
 
 
ddad86d
6b19fee
 
dc893c9
 
 
c1666a3
922f180
 
40a52b2
 
c1666a3
 
0360f8e
 
 
 
 
 
 
 
 
 
 
 
40a52b2
0360f8e
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import streamlit as st 
from pymongo import MongoClient 
from bardapi import Bard 
import os 
from plyer import notification as nt


uri = os.environ["MONGO_CONNECTION_STRING"]
client = MongoClient(uri, tlsCertificateKeyFile= "files/cert.pem")
db = client["Cosmo"]
col = db["Tasks"]

# def notifier():
#     nt.notify(
#         title = "This is notification",
#         message = "This is the message",
#         timeout = 10,
#         app_icon = "logo.png"
    # )


task_values = {
    "title" : st.text_input("Task Title"),
    "prio" : st.text_input("Priority"),
    "duedate" : st.text_input("Due Date"),
    "status" : False
}

if st.button("Create Task"):
    col.insert_one(task_values)
    st.success("Task Created Successfully!")
    st.balloons()


# if st.button("notify"):
#     st.toast("You have a new reminder")


import time

def get_user_input():
  reminder_message = st.text_input("Enter reminder message:")
  reminder_time = st.time_input("Enter reminder time:")
  return reminder_message, reminder_time

def show_toast_message(reminder_message, reminder_time):
  # Calculate the time difference between the current time and the reminder time.
  time_diff = reminder_time - time.localtime()

  # If the time difference is less than or equal to 0, then show the toast message.
  if time_diff <= 0 or if st.button("notify"):
    st.toast(reminder_message, icon="ℹ️")

# Get the user input.
reminder_message, reminder_time = get_user_input()

# Show the toast message at the specified time.
show_toast_message(reminder_message, reminder_time)