File size: 10,103 Bytes
fd58be6
ca83190
9ca12d9
7a0ed23
a29193b
e70422e
ca83190
7a0ed23
 
4b43d44
 
 
 
4525cd4
4b43d44
 
4b65f05
7a0ed23
 
4b43d44
7a0ed23
 
 
ddfdfe5
4b43d44
 
ddfdfe5
 
 
885127e
ddfdfe5
7a0ed23
 
4b43d44
7a0ed23
 
 
 
 
 
 
 
 
 
 
 
 
ddfdfe5
a29193b
e70422e
 
 
 
 
5c671de
e70422e
 
 
5c671de
e70422e
ddfdfe5
 
 
e70422e
 
5c671de
e70422e
 
 
 
 
 
 
5c671de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c47d7b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c671de
 
 
 
59fe105
5352193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
059f546
5352193
 
 
59fe105
 
5352193
59fe105
5352193
 
59fe105
 
885127e
b9ee2d3
5352193
 
 
 
059f546
 
 
a534dba
 
5352193
a534dba
5352193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b3f2bd3
a534dba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
import streamlit as st
import os
from PIL import Image
import random

st.set_page_config(page_title="Valentine's Day Surprise", page_icon="❤️", layout="wide")

# --- Startup Page ---
if not st.session_state.get('password_entered', False):
    col1, col2, col3 = st.columns([1, 2, 1])  # Create columns for layout
    with col2:  # Place image in the middle column
        try:
            image = Image.open("hvd.jpeg")
            st.image(image, use_container_width=True)  # Image scales within column
        except FileNotFoundError:
            st.error("Image file not found. Please place 'hvd.jpeg' in the same directory as your script.")

    st.markdown(
        """
        <div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 50vh;">  <h1 style="color: #f08080; font-family: 'Arial', sans-serif; font-size: 2em; margin-bottom: 0.5em;">Happy Valentine's Day!</h1>            <p style="font-size: 1.2em; margin-bottom: 1em;">Enter the secret word to unlock the surprise:</p>            <input type="password" id="password" placeholder="Enter the secret word" style="padding: 10px; font-size: 1em; border: 2px solid #f08080; border-radius: 5px; width: 80%; max-width: 300px;">        </div>
        """,
        unsafe_allow_html=True,
    )

    password_entered = st.text_input("", type="password", key="password_input")
    correct_password = "anna"

    if password_entered == correct_password:
        st.session_state.password_entered = True
        st.rerun()

    elif password_entered:
        st.error("Incorrect secret word. Try again.")
  

# --- Main Content (after password entered) ---
if st.session_state.get('password_entered', False):
    # Load previous data (if it exists)
    if os.path.exists("data.txt"):
        with open("data.txt", "r") as f:
            try:
                saved_data = eval(f.read())
            except:
                saved_data = {"messages": [], "reasons": [], "compliments": []}
    else:
        saved_data = {"messages": [], "reasons": [], "compliments": []}

    st.title("Happy Valentine's Day, My Love! ❤️")

    # --- Styling ---
    st.markdown(
        """
        <style>
        body {
            background-color: #f8f0e3;
            font-family: 'Arial', sans-serif;
        }
        .stButton>button {
            background-color: #f08080 !important;
            color: white !important;
            border: none;
            padding: 10px 20px;
            border-radius: 5px;
        }
        .stTextInput, .stTextArea, .stSelectbox {
            border: 2px solid #f08080;
            border-radius: 5px;
        }
        </style>
        """,
        unsafe_allow_html=True,
    )

    # --- Heart Animation ---
    st.markdown(
        """
        <div style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;">
            <div class="heart"></div>
            <div class="heart" style="left: 10%; animation-delay: 2s;"></div>
            <div class="heart" style="left: 20%; animation-delay: 1s;"></div>
            <div class="heart" style="left: 30%; animation-delay: 3s;"></div>
            <div class="heart" style="left: 40%; animation-delay: 0.5s;"></div>
            <div class="heart" style="left: 50%; animation-delay: 2.5s;"></div>
            <div class="heart" style="left: 60%; animation-delay: 1.5s;"></div>
            <div class="heart" style="left: 70%; animation-delay: 3.5s;"></div>
            <div class="heart" style="left: 80%; animation-delay: 0.8s;"></div>
            <div class="heart" style="left: 90%; animation-delay: 2.2s;"></div>
        </div>

        <style>
        .heart {
            position: absolute;
            width: 30px;
            height: 30px;
            background-color: #f08080;
            transform: rotate(-45deg);
            animation: heartAnimation 5s linear infinite;
        }

        .heart::before,
        .heart::after {
            content: "";
            position: absolute;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background-color: #f08080;
        }

        .heart::before {
            top: -15px;
            left: 0;
        }

        .heart::after {
            top: 0;
            left: 15px;
        }

        @keyframes heartAnimation {
            0% {
                top: -50px;
                opacity: 0;
            }
            50% {
                opacity: 1;
            }
            100% {
                top: 100vh;
                opacity: 0;
            }
        }
        </style>
        """,
        unsafe_allow_html=True,
    )

    # Tabs
    tabs = ["Compliments", "Messages", "Reasons"]
    selected_tab = st.sidebar.radio("Select a tab:", tabs)

    if selected_tab == "Compliments":
        st.write("## Sweet Compliments")

        compliments = [
            "You have the most beautiful smile.",
            "Your kindness is inspiring.",
            "You’re incredibly intelligent and witty.",
            "You make every day an adventure.",
            "Your laugh is contagious and makes me so happy.",
            "You have a heart of gold.",
            "You’re the most supportive person I know.",
            "You have amazing taste in everything.",
            "You’re my best friend and my soulmate.",
            "You’re simply amazing!"
        ]

        if saved_data["compliments"]:
            for i, compliment in enumerate(saved_data["compliments"]):
                col1, col2 = st.columns([0.8, 0.2])
                with col1:
                    st.write(f"{i+1}. {compliment}")
                with col2:
                    if st.button("Delete", key=f"delete_compliment_{i}"):
                        del saved_data["compliments"][i]
                        with open("data.txt", "w") as f:
                            f.write(str(saved_data))
                        st.rerun()

        if st.button("Generate Compliment"):
            random_compliment = random.choice(compliments)
            st.write(f"💖 {random_compliment}")
            saved_data["compliments"].append(random_compliment)
            with open("data.txt", "w") as f:
                f.write(str(saved_data))
            st.rerun()

    elif selected_tab == "Messages":
        st.write("## Sweet Messages")

        messages = [
            "I love you more than words can say.",
            "You're my everything.",
            "You make me happier than I ever thought I could be.",
            "I'm so lucky to have you in my life.",
            "You're the most amazing woman I know.",
            "I can't imagine my life without you.",
            "You're my best friend, my lover, and my soulmate.",
            "I cherish every moment I spend with you.",
            "You're the most beautiful woman in the world.",
            "I'm so grateful for your love and support."
        ]
        if saved_data["messages"]:
            for i, message in enumerate(saved_data["messages"]):
                col1, col2 = st.columns([0.8, 0.2])
                with col1:
                    st.markdown(f"<div style='background-color: #ffe6f2; padding: 10px; border-radius: 5px; margin-bottom: 10px;'>{message}</div>", unsafe_allow_html=True)
                with col2:
                    if st.button("Delete", key=f"delete_message_{i}"):
                        del saved_data["messages"][i]
                        with open("data.txt", "w") as f:
                            f.write(str(saved_data))
                        st.rerun()

        if st.button("Generate Message"):
            random_message = random.choice(messages)
            html_string = f"""<div style='background-color: #ffe6f2; padding: 10px; border-radius: 5px; margin-bottom: 10px;'>{random_message}</div>"""
            st.markdown(html_string, unsafe_allow_html=True)
            saved_data["messages"].append(random_message)
            with open("data.txt", "w") as f:
                f.write(str(saved_data))
            st.rerun()

        # Custom message area
        custom_message = st.text_area("Write a personal message for her:", height=100)
        if st.button("Save Custom Message"):
            if custom_message:
                saved_data["messages"].append(custom_message)
                with open("data.txt", "w") as f:
                    f.write(str(saved_data))
                st.success("Custom message saved!")
                st.rerun()

    elif selected_tab == "Reasons":
        st.write("## Reasons I Love You")

        reasons = [
            "Your smile brightens my day.",
            "You're incredibly kind and compassionate.",
            "You're intelligent and witty.",
            "You have a great sense of humor.",
            "You're beautiful inside and out.",
            "You're supportive and encouraging.",
            "You're passionate about what you do.",
            "You're a great listener.",
            "You make me laugh.",
            "You're my best friend.",
            "You inspire me to be a better person.",
            "You make me feel loved and cherished.",
            "You're my soulmate.",
            "I love your adventurous spirit.",
            "You make every day special."
        ]
        if saved_data["reasons"]:
            for i, reason in enumerate(saved_data["reasons"]):
                col1, col2 = st.columns([0.8, 0.2])
                with col1:
                    st.write(f"{i+1}. {reason}")
                with col2:
                    if st.button("Delete", key=f"delete_reason_{i}"):
                        del saved_data["reasons"][i]
                        with open("data.txt", "w") as f:
                            f.write(str(saved_data))
                        st.rerun()

        if st.button("Generate Reason"):
            random_reason = random.choice(reasons)
            st.write(f"{random_reason}")
            saved_data["reasons"].append(random_reason)
            with open("data.txt", "w") as f:
                f.write(str(saved_data))
            st.rerun()