Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1869,6 +1869,428 @@ def render_footer_html(footer_id: str, footer_info: dict, primary: str, secondar
|
|
| 1869 |
"""
|
| 1870 |
|
| 1871 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1872 |
def generate_background_gallery(theme_json: str = ""):
|
| 1873 |
"""
|
| 1874 |
Generate HTML gallery of all 30 backgrounds organized by category
|
|
@@ -2154,6 +2576,82 @@ def generate_footer_gallery(theme_json: str = ""):
|
|
| 2154 |
return "".join(html_parts)
|
| 2155 |
|
| 2156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2157 |
def generate_single_background_preview(bg_id: str):
|
| 2158 |
"""
|
| 2159 |
Generate preview code for a single background
|
|
@@ -2673,6 +3171,29 @@ Snapchat - bright colors, fun filters, youthful design""",
|
|
| 2673 |
outputs=[footer_gallery_html]
|
| 2674 |
)
|
| 2675 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2676 |
|
| 2677 |
# Connect button
|
| 2678 |
generate_flutter_btn.click(
|
|
|
|
| 1869 |
"""
|
| 1870 |
|
| 1871 |
|
| 1872 |
+
def render_card_html(card_id: str, card_info: dict, primary: str, secondary: str, accent: str) -> str:
|
| 1873 |
+
"""
|
| 1874 |
+
Generate HTML/CSS for a single card preview (30 card types)
|
| 1875 |
+
Returns HTML div with the card rendered
|
| 1876 |
+
"""
|
| 1877 |
+
card_name = card_info['name']
|
| 1878 |
+
|
| 1879 |
+
# Common container style
|
| 1880 |
+
base_style = "width: 180px; min-height: 240px; border-radius: 12px; position: relative; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex; flex-direction: column;"
|
| 1881 |
+
|
| 1882 |
+
# PRODUCT & SHOPPING (6)
|
| 1883 |
+
if card_id == "product_vertical":
|
| 1884 |
+
content = f"""
|
| 1885 |
+
<div style="background: #f5f5f5; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 48px;">π±</div>
|
| 1886 |
+
<div style="padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 6px;">
|
| 1887 |
+
<div style="font-weight: 700; font-size: 13px; color: #333;">Product Name</div>
|
| 1888 |
+
<div style="font-size: 11px; color: #666;">Short description</div>
|
| 1889 |
+
<div style="margin-top: auto; font-weight: 700; font-size: 16px; color: {primary};">$99.00</div>
|
| 1890 |
+
</div>
|
| 1891 |
+
"""
|
| 1892 |
+
elif card_id == "product_horizontal":
|
| 1893 |
+
base_style = "width: 280px; height: 100px; border-radius: 12px; position: relative; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex;"
|
| 1894 |
+
content = f"""
|
| 1895 |
+
<div style="width: 100px; background: #f5f5f5; display: flex; align-items: center; justify-content: center; font-size: 36px;">π±</div>
|
| 1896 |
+
<div style="padding: 12px; flex: 1; display: flex; flex-direction: column; justify-content: space-between;">
|
| 1897 |
+
<div>
|
| 1898 |
+
<div style="font-weight: 700; font-size: 13px; color: #333;">Product Name</div>
|
| 1899 |
+
<div style="font-size: 10px; color: #666;">Category</div>
|
| 1900 |
+
</div>
|
| 1901 |
+
<div style="font-weight: 700; font-size: 14px; color: {primary};">$99.00</div>
|
| 1902 |
+
</div>
|
| 1903 |
+
"""
|
| 1904 |
+
elif card_id == "product_badge":
|
| 1905 |
+
content = f"""
|
| 1906 |
+
<div style="position: relative; background: #f5f5f5; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 48px;">
|
| 1907 |
+
π±
|
| 1908 |
+
<div style="position: absolute; top: 8px; right: 8px; background: #FF3B30; color: white; padding: 4px 10px; border-radius: 12px; font-size: 10px; font-weight: 700;">SALE</div>
|
| 1909 |
+
</div>
|
| 1910 |
+
<div style="padding: 12px; flex: 1;">
|
| 1911 |
+
<div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Product Name</div>
|
| 1912 |
+
<div style="display: flex; align-items: center; gap: 8px;">
|
| 1913 |
+
<div style="font-weight: 700; font-size: 16px; color: {primary};">$79.00</div>
|
| 1914 |
+
<div style="font-size: 12px; color: #999; text-decoration: line-through;">$99.00</div>
|
| 1915 |
+
</div>
|
| 1916 |
+
</div>
|
| 1917 |
+
"""
|
| 1918 |
+
elif card_id == "product_rating":
|
| 1919 |
+
content = f"""
|
| 1920 |
+
<div style="background: #f5f5f5; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 48px;">π±</div>
|
| 1921 |
+
<div style="padding: 12px; flex: 1;">
|
| 1922 |
+
<div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 6px;">Product Name</div>
|
| 1923 |
+
<div style="display: flex; align-items: center; gap: 4px; margin-bottom: 8px;">
|
| 1924 |
+
<span style="color: #FFB800;">βββββ</span>
|
| 1925 |
+
<span style="font-size: 10px; color: #666;">(245)</span>
|
| 1926 |
+
</div>
|
| 1927 |
+
<div style="font-weight: 700; font-size: 16px; color: {primary};">$99.00</div>
|
| 1928 |
+
</div>
|
| 1929 |
+
"""
|
| 1930 |
+
elif card_id == "product_grid_compact":
|
| 1931 |
+
base_style = "width: 140px; min-height: 180px; border-radius: 12px; position: relative; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex; flex-direction: column;"
|
| 1932 |
+
content = f"""
|
| 1933 |
+
<div style="background: #f5f5f5; height: 120px; display: flex; align-items: center; justify-content: center; font-size: 40px;">π±</div>
|
| 1934 |
+
<div style="padding: 8px;">
|
| 1935 |
+
<div style="font-weight: 600; font-size: 11px; color: #333; margin-bottom: 4px;">Item</div>
|
| 1936 |
+
<div style="font-weight: 700; font-size: 13px; color: {primary};">$99</div>
|
| 1937 |
+
</div>
|
| 1938 |
+
"""
|
| 1939 |
+
elif card_id == "product_featured":
|
| 1940 |
+
base_style = "width: 280px; height: 200px; border-radius: 12px; position: relative; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: linear-gradient(135deg, {primary}, {secondary});"
|
| 1941 |
+
content = f"""
|
| 1942 |
+
<div style="position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);">
|
| 1943 |
+
<div style="color: white; font-size: 11px; opacity: 0.9; margin-bottom: 4px;">FEATURED</div>
|
| 1944 |
+
<div style="color: white; font-weight: 700; font-size: 18px; margin-bottom: 4px;">Premium Product</div>
|
| 1945 |
+
<div style="color: white; font-size: 20px; font-weight: 700;">$199.00</div>
|
| 1946 |
+
</div>
|
| 1947 |
+
"""
|
| 1948 |
+
|
| 1949 |
+
# PROFILE & SOCIAL (5)
|
| 1950 |
+
elif card_id == "profile_user_card":
|
| 1951 |
+
content = f"""
|
| 1952 |
+
<div style="padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px;">
|
| 1953 |
+
<div style="width: 64px; height: 64px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 32px;">π€</div>
|
| 1954 |
+
<div style="text-align: center;">
|
| 1955 |
+
<div style="font-weight: 700; font-size: 14px; color: #333;">John Doe</div>
|
| 1956 |
+
<div style="font-size: 11px; color: #666; margin-top: 2px;">@johndoe</div>
|
| 1957 |
+
</div>
|
| 1958 |
+
<div style="font-size: 11px; color: #666; text-align: center;">Creative designer & developer passionate about UI/UX</div>
|
| 1959 |
+
<button style="background: {primary}; color: white; border: none; padding: 8px 24px; border-radius: 20px; font-size: 12px; font-weight: 600; margin-top: 4px;">Follow</button>
|
| 1960 |
+
</div>
|
| 1961 |
+
"""
|
| 1962 |
+
elif card_id == "profile_stats_card":
|
| 1963 |
+
content = f"""
|
| 1964 |
+
<div style="padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px;">
|
| 1965 |
+
<div style="width: 60px; height: 60px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 30px;">π€</div>
|
| 1966 |
+
<div style="text-align: center;">
|
| 1967 |
+
<div style="font-weight: 700; font-size: 14px; color: #333;">Sarah Smith</div>
|
| 1968 |
+
<div style="font-size: 10px; color: #666;">Product Designer</div>
|
| 1969 |
+
</div>
|
| 1970 |
+
<div style="display: flex; gap: 16px; margin-top: 4px;">
|
| 1971 |
+
<div style="text-align: center;">
|
| 1972 |
+
<div style="font-weight: 700; font-size: 14px; color: #333;">2.5K</div>
|
| 1973 |
+
<div style="font-size: 9px; color: #666;">Followers</div>
|
| 1974 |
+
</div>
|
| 1975 |
+
<div style="text-align: center;">
|
| 1976 |
+
<div style="font-weight: 700; font-size: 14px; color: #333;">856</div>
|
| 1977 |
+
<div style="font-size: 9px; color: #666;">Posts</div>
|
| 1978 |
+
</div>
|
| 1979 |
+
<div style="text-align: center;">
|
| 1980 |
+
<div style="font-weight: 700; font-size: 14px; color: #333;">12K</div>
|
| 1981 |
+
<div style="font-size: 9px; color: #666;">Likes</div>
|
| 1982 |
+
</div>
|
| 1983 |
+
</div>
|
| 1984 |
+
</div>
|
| 1985 |
+
"""
|
| 1986 |
+
elif card_id == "social_post_card":
|
| 1987 |
+
base_style = "width: 280px; min-height: 280px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;"
|
| 1988 |
+
content = f"""
|
| 1989 |
+
<div style="padding: 12px; display: flex; align-items: center; gap: 10px;">
|
| 1990 |
+
<div style="width: 40px; height: 40px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px;">π€</div>
|
| 1991 |
+
<div>
|
| 1992 |
+
<div style="font-weight: 700; font-size: 13px; color: #333;">Jane Cooper</div>
|
| 1993 |
+
<div style="font-size: 10px; color: #666;">2 hours ago</div>
|
| 1994 |
+
</div>
|
| 1995 |
+
</div>
|
| 1996 |
+
<div style="padding: 0 12px 12px; font-size: 12px; color: #333;">Just launched my new project! π Check it out!</div>
|
| 1997 |
+
<div style="background: #f0f0f0; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 48px;">π¨</div>
|
| 1998 |
+
<div style="padding: 12px; display: flex; gap: 16px; border-top: 1px solid #eee; font-size: 11px; color: #666;">
|
| 1999 |
+
<span>β€οΈ 245</span>
|
| 2000 |
+
<span>π¬ 32</span>
|
| 2001 |
+
<span>π€ 12</span>
|
| 2002 |
+
</div>
|
| 2003 |
+
"""
|
| 2004 |
+
elif card_id == "social_story_card":
|
| 2005 |
+
base_style = "width: 100px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: relative;"
|
| 2006 |
+
content = f"""
|
| 2007 |
+
<div style="position: absolute; inset: 2px; border-radius: 10px; background: linear-gradient(135deg, {primary}, {secondary}); display: flex; align-items: center; justify-content: center; color: white; font-size: 40px;">π€</div>
|
| 2008 |
+
<div style="position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; color: white; font-size: 10px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,0.5);">Sarah</div>
|
| 2009 |
+
"""
|
| 2010 |
+
elif card_id == "contact_card":
|
| 2011 |
+
content = f"""
|
| 2012 |
+
<div style="padding: 16px; display: flex; flex-direction: column; gap: 10px;">
|
| 2013 |
+
<div style="display: flex; align-items: center; gap: 12px;">
|
| 2014 |
+
<div style="width: 50px; height: 50px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px;">π€</div>
|
| 2015 |
+
<div style="flex: 1;">
|
| 2016 |
+
<div style="font-weight: 700; font-size: 13px; color: #333;">Mike Johnson</div>
|
| 2017 |
+
<div style="font-size: 10px; color: #666;">Software Engineer</div>
|
| 2018 |
+
</div>
|
| 2019 |
+
</div>
|
| 2020 |
+
<div style="display: flex; flex-direction: column; gap: 6px; font-size: 11px;">
|
| 2021 |
+
<div style="display: flex; align-items: center; gap: 6px; color: #666;">
|
| 2022 |
+
<span>π§</span>
|
| 2023 |
+
<span>mike@email.com</span>
|
| 2024 |
+
</div>
|
| 2025 |
+
<div style="display: flex; align-items: center; gap: 6px; color: #666;">
|
| 2026 |
+
<span>π±</span>
|
| 2027 |
+
<span>+1 234 567 8900</span>
|
| 2028 |
+
</div>
|
| 2029 |
+
</div>
|
| 2030 |
+
<div style="display: flex; gap: 8px; margin-top: 4px;">
|
| 2031 |
+
<button style="flex: 1; background: {primary}; color: white; border: none; padding: 8px; border-radius: 8px; font-size: 11px; font-weight: 600;">Message</button>
|
| 2032 |
+
<button style="flex: 1; background: #f0f0f0; color: #333; border: none; padding: 8px; border-radius: 8px; font-size: 11px; font-weight: 600;">Call</button>
|
| 2033 |
+
</div>
|
| 2034 |
+
</div>
|
| 2035 |
+
"""
|
| 2036 |
+
|
| 2037 |
+
# CONTENT & MEDIA (5)
|
| 2038 |
+
elif card_id == "article_card":
|
| 2039 |
+
base_style = "width: 280px; min-height: 260px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;"
|
| 2040 |
+
content = f"""
|
| 2041 |
+
<div style="background: #f0f0f0; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 48px;">π°</div>
|
| 2042 |
+
<div style="padding: 14px;">
|
| 2043 |
+
<div style="font-size: 10px; color: {primary}; font-weight: 600; margin-bottom: 6px;">TECHNOLOGY</div>
|
| 2044 |
+
<div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 8px;">The Future of AI in Design</div>
|
| 2045 |
+
<div style="font-size: 11px; color: #666; line-height: 1.4; margin-bottom: 10px;">Discover how artificial intelligence is revolutionizing the creative industry...</div>
|
| 2046 |
+
<div style="font-size: 10px; color: #999;">β±οΈ 5 min read</div>
|
| 2047 |
+
</div>
|
| 2048 |
+
"""
|
| 2049 |
+
elif card_id == "video_card":
|
| 2050 |
+
base_style = "width: 280px; height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: relative;"
|
| 2051 |
+
content = f"""
|
| 2052 |
+
<div style="position: absolute; inset: 0; background: linear-gradient(135deg, #667eea, #764ba2); display: flex; align-items: center; justify-content: center; color: white; font-size: 64px;">βΆοΈ</div>
|
| 2053 |
+
<div style="position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.7); color: white; padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 600;">12:45</div>
|
| 2054 |
+
<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); padding: 12px; color: white;">
|
| 2055 |
+
<div style="font-weight: 700; font-size: 13px;">How to Build Apps</div>
|
| 2056 |
+
<div style="font-size: 10px; opacity: 0.9; margin-top: 2px;">12K views β’ 2 days ago</div>
|
| 2057 |
+
</div>
|
| 2058 |
+
"""
|
| 2059 |
+
elif card_id == "podcast_card":
|
| 2060 |
+
base_style = "width: 280px; height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex;"
|
| 2061 |
+
content = f"""
|
| 2062 |
+
<div style="width: 120px; background: linear-gradient(135deg, {primary}, {secondary}); display: flex; align-items: center; justify-content: center; font-size: 48px; color: white;">ποΈ</div>
|
| 2063 |
+
<div style="flex: 1; padding: 12px; display: flex; flex-direction: column; justify-content: space-between;">
|
| 2064 |
+
<div>
|
| 2065 |
+
<div style="font-weight: 700; font-size: 12px; color: #333;">Tech Talk #42</div>
|
| 2066 |
+
<div style="font-size: 10px; color: #666; margin-top: 2px;">The Future of Web3</div>
|
| 2067 |
+
</div>
|
| 2068 |
+
<div style="display: flex; align-items: center; gap: 8px;">
|
| 2069 |
+
<button style="width: 32px; height: 32px; border-radius: 50%; background: {primary}; color: white; border: none; display: flex; align-items: center; justify-content: center; font-size: 12px;">βΆοΈ</button>
|
| 2070 |
+
<div style="font-size: 10px; color: #666;">45:30</div>
|
| 2071 |
+
</div>
|
| 2072 |
+
</div>
|
| 2073 |
+
"""
|
| 2074 |
+
elif card_id == "news_headline":
|
| 2075 |
+
base_style = "width: 280px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex; gap: 12px; padding: 10px;"
|
| 2076 |
+
content = f"""
|
| 2077 |
+
<div style="width: 60px; height: 60px; border-radius: 8px; background: #f0f0f0; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 24px;">π°</div>
|
| 2078 |
+
<div style="flex: 1; display: flex; flex-direction: column; justify-content: space-between;">
|
| 2079 |
+
<div style="font-weight: 600; font-size: 12px; color: #333; line-height: 1.3;">Breaking: Major Tech Announcement Today</div>
|
| 2080 |
+
<div style="font-size: 9px; color: #999;">2 hours ago β’ Tech News</div>
|
| 2081 |
+
</div>
|
| 2082 |
+
"""
|
| 2083 |
+
elif card_id == "blog_featured":
|
| 2084 |
+
base_style = "width: 280px; height: 240px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: relative;"
|
| 2085 |
+
content = f"""
|
| 2086 |
+
<div style="position: absolute; inset: 0; background: linear-gradient(135deg, {primary}, {secondary});"></div>
|
| 2087 |
+
<div style="position: absolute; top: 12px; left: 12px; background: white; color: {primary}; padding: 4px 10px; border-radius: 16px; font-size: 9px; font-weight: 700;">FEATURED</div>
|
| 2088 |
+
<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); padding: 16px; color: white;">
|
| 2089 |
+
<div style="font-size: 10px; opacity: 0.9; margin-bottom: 4px;">DESIGN</div>
|
| 2090 |
+
<div style="font-weight: 700; font-size: 16px; margin-bottom: 4px;">Creating Beautiful User Experiences</div>
|
| 2091 |
+
<div style="font-size: 10px; opacity: 0.8;">by Sarah Johnson β’ 8 min read</div>
|
| 2092 |
+
</div>
|
| 2093 |
+
"""
|
| 2094 |
+
|
| 2095 |
+
# STATS & ANALYTICS (4)
|
| 2096 |
+
elif card_id == "stats_metric":
|
| 2097 |
+
base_style = "width: 160px; height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; justify-content: space-between;"
|
| 2098 |
+
content = f"""
|
| 2099 |
+
<div style="width: 40px; height: 40px; border-radius: 10px; background: {primary}20; color: {primary}; display: flex; align-items: center; justify-content: center; font-size: 20px;">π</div>
|
| 2100 |
+
<div>
|
| 2101 |
+
<div style="font-size: 24px; font-weight: 700; color: #333; margin-bottom: 2px;">2,458</div>
|
| 2102 |
+
<div style="font-size: 11px; color: #666;">Total Sales</div>
|
| 2103 |
+
<div style="font-size: 10px; color: #34C759; font-weight: 600; margin-top: 4px;">β +12.5%</div>
|
| 2104 |
+
</div>
|
| 2105 |
+
"""
|
| 2106 |
+
elif card_id == "stats_comparison":
|
| 2107 |
+
base_style = "width: 240px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; gap: 16px;"
|
| 2108 |
+
content = f"""
|
| 2109 |
+
<div style="flex: 1; text-align: center;">
|
| 2110 |
+
<div style="font-size: 20px; font-weight: 700; color: #333;">1,234</div>
|
| 2111 |
+
<div style="font-size: 10px; color: #666; margin-top: 2px;">This Month</div>
|
| 2112 |
+
<div style="font-size: 10px; color: #34C759; font-weight: 600; margin-top: 4px;">β +18%</div>
|
| 2113 |
+
</div>
|
| 2114 |
+
<div style="width: 1px; background: #eee;"></div>
|
| 2115 |
+
<div style="flex: 1; text-align: center;">
|
| 2116 |
+
<div style="font-size: 20px; font-weight: 700; color: #333;">1,045</div>
|
| 2117 |
+
<div style="font-size: 10px; color: #666; margin-top: 2px;">Last Month</div>
|
| 2118 |
+
<div style="font-size: 10px; color: #666; font-weight: 600; margin-top: 4px;">β 0%</div>
|
| 2119 |
+
</div>
|
| 2120 |
+
"""
|
| 2121 |
+
elif card_id == "stats_progress":
|
| 2122 |
+
base_style = "width: 200px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; justify-content: space-between;"
|
| 2123 |
+
content = f"""
|
| 2124 |
+
<div style="display: flex; justify-content: space-between; align-items: center;">
|
| 2125 |
+
<div style="font-weight: 600; font-size: 12px; color: #333;">Goal Progress</div>
|
| 2126 |
+
<div style="font-weight: 700; font-size: 14px; color: {primary};">75%</div>
|
| 2127 |
+
</div>
|
| 2128 |
+
<div>
|
| 2129 |
+
<div style="height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden;">
|
| 2130 |
+
<div style="width: 75%; height: 100%; background: {primary}; border-radius: 4px;"></div>
|
| 2131 |
+
</div>
|
| 2132 |
+
<div style="font-size: 10px; color: #666; margin-top: 6px;">750 / 1000 completed</div>
|
| 2133 |
+
</div>
|
| 2134 |
+
"""
|
| 2135 |
+
elif card_id == "stats_chart":
|
| 2136 |
+
base_style = "width: 200px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;"
|
| 2137 |
+
content = f"""
|
| 2138 |
+
<div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Weekly Stats</div>
|
| 2139 |
+
<div style="font-size: 10px; color: #666; margin-bottom: 12px;">Last 7 days</div>
|
| 2140 |
+
<div style="display: flex; align-items: flex-end; gap: 6px; height: 60px;">
|
| 2141 |
+
<div style="flex: 1; background: {primary}; opacity: 0.4; height: 40%; border-radius: 4px 4px 0 0;"></div>
|
| 2142 |
+
<div style="flex: 1; background: {primary}; opacity: 0.6; height: 60%; border-radius: 4px 4px 0 0;"></div>
|
| 2143 |
+
<div style="flex: 1; background: {primary}; opacity: 0.5; height: 50%; border-radius: 4px 4px 0 0;"></div>
|
| 2144 |
+
<div style="flex: 1; background: {primary}; opacity: 0.8; height: 80%; border-radius: 4px 4px 0 0;"></div>
|
| 2145 |
+
<div style="flex: 1; background: {primary}; opacity: 0.9; height: 90%; border-radius: 4px 4px 0 0;"></div>
|
| 2146 |
+
<div style="flex: 1; background: {primary}; height: 100%; border-radius: 4px 4px 0 0;"></div>
|
| 2147 |
+
<div style="flex: 1; background: {primary}; opacity: 0.7; height: 70%; border-radius: 4px 4px 0 0;"></div>
|
| 2148 |
+
</div>
|
| 2149 |
+
"""
|
| 2150 |
+
|
| 2151 |
+
# MESSAGING & NOTIFICATIONS (4)
|
| 2152 |
+
elif card_id == "message_preview":
|
| 2153 |
+
base_style = "width: 280px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex; align-items: center; gap: 12px; padding: 12px;"
|
| 2154 |
+
content = f"""
|
| 2155 |
+
<div style="width: 48px; height: 48px; border-radius: 50%; background: {primary}; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px;">π€</div>
|
| 2156 |
+
<div style="flex: 1; min-width: 0;">
|
| 2157 |
+
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;">
|
| 2158 |
+
<div style="font-weight: 700; font-size: 13px; color: #333;">Alice Brown</div>
|
| 2159 |
+
<div style="font-size: 9px; color: #999;">2m</div>
|
| 2160 |
+
</div>
|
| 2161 |
+
<div style="font-size: 11px; color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">Hey! Did you see the new design?</div>
|
| 2162 |
+
</div>
|
| 2163 |
+
<div style="width: 8px; height: 8px; border-radius: 50%; background: {primary}; flex-shrink: 0;"></div>
|
| 2164 |
+
"""
|
| 2165 |
+
elif card_id == "notification_card":
|
| 2166 |
+
content = f"""
|
| 2167 |
+
<div style="padding: 14px; display: flex; gap: 12px;">
|
| 2168 |
+
<div style="width: 40px; height: 40px; border-radius: 50%; background: {primary}20; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: {primary}; font-size: 20px;">π</div>
|
| 2169 |
+
<div style="flex: 1;">
|
| 2170 |
+
<div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 4px;">
|
| 2171 |
+
<div style="font-weight: 700; font-size: 12px; color: #333;">New Message</div>
|
| 2172 |
+
<div style="width: 6px; height: 6px; border-radius: 50%; background: {primary};"></div>
|
| 2173 |
+
</div>
|
| 2174 |
+
<div style="font-size: 11px; color: #666; line-height: 1.4; margin-bottom: 6px;">You have a new message from the support team</div>
|
| 2175 |
+
<div style="font-size: 9px; color: #999;">5 minutes ago</div>
|
| 2176 |
+
</div>
|
| 2177 |
+
</div>
|
| 2178 |
+
"""
|
| 2179 |
+
elif card_id == "alert_card":
|
| 2180 |
+
base_style = "width: 280px; min-height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: #FFF3CD; border: 1px solid #FFE69C;"
|
| 2181 |
+
content = f"""
|
| 2182 |
+
<div style="padding: 14px; display: flex; gap: 12px; align-items: start;">
|
| 2183 |
+
<div style="font-size: 20px;">β οΈ</div>
|
| 2184 |
+
<div style="flex: 1;">
|
| 2185 |
+
<div style="font-weight: 700; font-size: 12px; color: #856404; margin-bottom: 4px;">Warning</div>
|
| 2186 |
+
<div style="font-size: 11px; color: #856404;">Your storage is almost full. Please free up some space.</div>
|
| 2187 |
+
</div>
|
| 2188 |
+
<button style="background: transparent; border: none; color: #856404; font-size: 16px; cursor: pointer;">Γ</button>
|
| 2189 |
+
</div>
|
| 2190 |
+
"""
|
| 2191 |
+
elif card_id == "chat_bubble":
|
| 2192 |
+
base_style = "width: 220px; min-height: 60px; border-radius: 16px 16px 16px 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: {primary}; padding: 12px; position: relative;"
|
| 2193 |
+
content = f"""
|
| 2194 |
+
<div style="color: white; font-size: 12px; line-height: 1.4; margin-bottom: 4px;">Hey! How are you doing? I wanted to check in about the project.</div>
|
| 2195 |
+
<div style="text-align: right; font-size: 9px; color: rgba(255,255,255,0.8);">2:45 PM</div>
|
| 2196 |
+
"""
|
| 2197 |
+
|
| 2198 |
+
# SPECIAL CARDS (6)
|
| 2199 |
+
elif card_id == "pricing_plan":
|
| 2200 |
+
base_style = "width: 200px; min-height: 280px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; border: 2px solid #eee;"
|
| 2201 |
+
content = f"""
|
| 2202 |
+
<div style="padding: 20px; text-align: center; background: {primary}10;">
|
| 2203 |
+
<div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 8px;">Pro Plan</div>
|
| 2204 |
+
<div style="font-size: 32px; font-weight: 700; color: {primary}; margin-bottom: 4px;">$29<span style="font-size: 14px; font-weight: 400;">/mo</span></div>
|
| 2205 |
+
</div>
|
| 2206 |
+
<div style="padding: 20px; display: flex; flex-direction: column; gap: 8px;">
|
| 2207 |
+
<div style="font-size: 11px; color: #666; display: flex; align-items: center; gap: 6px;">β 100 Projects</div>
|
| 2208 |
+
<div style="font-size: 11px; color: #666; display: flex; align-items: center; gap: 6px;">β Unlimited Storage</div>
|
| 2209 |
+
<div style="font-size: 11px; color: #666; display: flex; align-items: center; gap: 6px;">β Priority Support</div>
|
| 2210 |
+
<div style="font-size: 11px; color: #666; display: flex; align-items: center; gap: 6px;">β Analytics</div>
|
| 2211 |
+
<button style="width: 100%; background: {primary}; color: white; border: none; padding: 10px; border-radius: 8px; font-size: 12px; font-weight: 600; margin-top: 8px;">Get Started</button>
|
| 2212 |
+
</div>
|
| 2213 |
+
"""
|
| 2214 |
+
elif card_id == "review_card":
|
| 2215 |
+
content = f"""
|
| 2216 |
+
<div style="padding: 16px;">
|
| 2217 |
+
<div style="display: flex; align-items: center; gap: 10px; margin-bottom: 10px;">
|
| 2218 |
+
<div style="width: 40px; height: 40px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px;">π€</div>
|
| 2219 |
+
<div style="flex: 1;">
|
| 2220 |
+
<div style="font-weight: 700; font-size: 12px; color: #333;">Emily Davis</div>
|
| 2221 |
+
<div style="color: #FFB800; font-size: 12px;">βββββ</div>
|
| 2222 |
+
</div>
|
| 2223 |
+
</div>
|
| 2224 |
+
<div style="font-size: 11px; color: #666; line-height: 1.5; margin-bottom: 8px;">"Amazing product! Exceeded all my expectations. Highly recommend to anyone looking for quality."</div>
|
| 2225 |
+
<div style="font-size: 9px; color: #999;">2 days ago</div>
|
| 2226 |
+
</div>
|
| 2227 |
+
"""
|
| 2228 |
+
elif card_id == "event_card":
|
| 2229 |
+
base_style = "width: 280px; height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex;"
|
| 2230 |
+
content = f"""
|
| 2231 |
+
<div style="width: 80px; background: {primary}; color: white; display: flex; flex-direction: column; align-items: center; justify-content: center;">
|
| 2232 |
+
<div style="font-size: 28px; font-weight: 700;">24</div>
|
| 2233 |
+
<div style="font-size: 11px; opacity: 0.9;">DEC</div>
|
| 2234 |
+
</div>
|
| 2235 |
+
<div style="flex: 1; padding: 14px; display: flex; flex-direction: column; justify-content: space-between;">
|
| 2236 |
+
<div>
|
| 2237 |
+
<div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Tech Conference 2024</div>
|
| 2238 |
+
<div style="font-size: 10px; color: #666; display: flex; align-items: center; gap: 4px;">π San Francisco, CA</div>
|
| 2239 |
+
</div>
|
| 2240 |
+
<div style="font-size: 10px; color: #666;">π₯ 245 attending</div>
|
| 2241 |
+
</div>
|
| 2242 |
+
"""
|
| 2243 |
+
elif card_id == "offer_coupon":
|
| 2244 |
+
base_style = "width: 260px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; border: 2px dashed {primary}; position: relative;"
|
| 2245 |
+
content = f"""
|
| 2246 |
+
<div style="padding: 20px; text-align: center;">
|
| 2247 |
+
<div style="font-size: 10px; color: {primary}; font-weight: 600; margin-bottom: 8px;">SPECIAL OFFER</div>
|
| 2248 |
+
<div style="font-size: 32px; font-weight: 700; color: {primary}; margin-bottom: 4px;">25% OFF</div>
|
| 2249 |
+
<div style="font-size: 11px; color: #666; margin-bottom: 12px;">On your next purchase</div>
|
| 2250 |
+
<div style="background: {primary}10; padding: 8px 16px; border-radius: 8px; display: inline-block;">
|
| 2251 |
+
<div style="font-size: 10px; color: #666; margin-bottom: 2px;">Code:</div>
|
| 2252 |
+
<div style="font-weight: 700; font-size: 14px; color: {primary}; letter-spacing: 1px;">SAVE25</div>
|
| 2253 |
+
</div>
|
| 2254 |
+
<div style="font-size: 9px; color: #999; margin-top: 8px;">Expires in 3 days</div>
|
| 2255 |
+
</div>
|
| 2256 |
+
"""
|
| 2257 |
+
elif card_id == "weather_card":
|
| 2258 |
+
base_style = "width: 200px; height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: linear-gradient(135deg, {primary}, {secondary}); color: white; padding: 20px;"
|
| 2259 |
+
content = f"""
|
| 2260 |
+
<div style="text-align: center;">
|
| 2261 |
+
<div style="font-size: 12px; opacity: 0.9; margin-bottom: 8px;">San Francisco</div>
|
| 2262 |
+
<div style="font-size: 64px; margin-bottom: 8px;">βοΈ</div>
|
| 2263 |
+
<div style="font-size: 40px; font-weight: 700; margin-bottom: 4px;">72Β°</div>
|
| 2264 |
+
<div style="font-size: 11px; opacity: 0.9; margin-bottom: 16px;">Sunny</div>
|
| 2265 |
+
<div style="display: flex; justify-content: space-around; font-size: 10px;">
|
| 2266 |
+
<div>H: 78Β°</div>
|
| 2267 |
+
<div>L: 65Β°</div>
|
| 2268 |
+
</div>
|
| 2269 |
+
</div>
|
| 2270 |
+
"""
|
| 2271 |
+
elif card_id == "ticket_card":
|
| 2272 |
+
base_style = "width: 280px; height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; position: relative;"
|
| 2273 |
+
content = f"""
|
| 2274 |
+
<div style="padding: 20px; padding-bottom: 16px;">
|
| 2275 |
+
<div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 8px;">Concert Night 2024</div>
|
| 2276 |
+
<div style="font-size: 11px; color: #666; margin-bottom: 4px;">π
Dec 25, 2024 β’ 8:00 PM</div>
|
| 2277 |
+
<div style="font-size: 11px; color: #666; margin-bottom: 12px;">π Madison Square Garden</div>
|
| 2278 |
+
<div style="font-size: 10px; color: #666; margin-bottom: 4px;">Seat: A-12 | Row: 5</div>
|
| 2279 |
+
</div>
|
| 2280 |
+
<div style="position: absolute; bottom: 0; left: 0; right: 0; height: 40px; background: {primary}10; border-top: 2px dashed {primary}; display: flex; align-items: center; justify-content: center;">
|
| 2281 |
+
<div style="font-family: monospace; font-size: 14px; font-weight: 700; letter-spacing: 2px; color: #333;">|||||||||||||||</div>
|
| 2282 |
+
</div>
|
| 2283 |
+
"""
|
| 2284 |
+
else:
|
| 2285 |
+
content = "<div style='padding: 20px; color: #333;'>Card Preview</div>"
|
| 2286 |
+
|
| 2287 |
+
return f"""
|
| 2288 |
+
<div style="{base_style}">
|
| 2289 |
+
{content}
|
| 2290 |
+
</div>
|
| 2291 |
+
"""
|
| 2292 |
+
|
| 2293 |
+
|
| 2294 |
def generate_background_gallery(theme_json: str = ""):
|
| 2295 |
"""
|
| 2296 |
Generate HTML gallery of all 30 backgrounds organized by category
|
|
|
|
| 2576 |
return "".join(html_parts)
|
| 2577 |
|
| 2578 |
|
| 2579 |
+
def generate_card_gallery(theme_json: str = ""):
|
| 2580 |
+
"""
|
| 2581 |
+
Generate HTML gallery of all 30 card types
|
| 2582 |
+
Cards are rendered directly with HTML/CSS using theme colors
|
| 2583 |
+
"""
|
| 2584 |
+
from agents.flutter_screen_generator import FlutterScreenGenerator
|
| 2585 |
+
|
| 2586 |
+
agent = FlutterScreenGenerator()
|
| 2587 |
+
catalog = agent.CARD_CATALOG
|
| 2588 |
+
|
| 2589 |
+
# Parse theme or use defaults
|
| 2590 |
+
if theme_json and theme_json.strip():
|
| 2591 |
+
try:
|
| 2592 |
+
theme_data = json.loads(theme_json)
|
| 2593 |
+
palette = theme_data.get("palette", {})
|
| 2594 |
+
primary = palette.get("primary", "#2196F3")
|
| 2595 |
+
secondary = palette.get("secondary", "#FF9800")
|
| 2596 |
+
accent = palette.get("accent", "#4CAF50")
|
| 2597 |
+
except:
|
| 2598 |
+
primary = "#2196F3"
|
| 2599 |
+
secondary = "#FF9800"
|
| 2600 |
+
accent = "#4CAF50"
|
| 2601 |
+
else:
|
| 2602 |
+
primary = "#2196F3"
|
| 2603 |
+
secondary = "#FF9800"
|
| 2604 |
+
accent = "#4CAF50"
|
| 2605 |
+
|
| 2606 |
+
# Start HTML
|
| 2607 |
+
html_parts = []
|
| 2608 |
+
html_parts.append("""
|
| 2609 |
+
<div style="background: #f8f9fa; padding: 24px; border-radius: 12px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
|
| 2610 |
+
<h3 style="margin-top: 0; color: #212529; font-size: 20px;">π΄ Card Catalog (30 Card Types)</h3>
|
| 2611 |
+
<p style="color: #6c757d; font-size: 14px; margin-bottom: 24px;">
|
| 2612 |
+
30 tipologie di cards diverse - product, profile, social, content, stats, messaging, special - renderizzate con i tuoi colori
|
| 2613 |
+
</p>
|
| 2614 |
+
""")
|
| 2615 |
+
|
| 2616 |
+
# Grid container
|
| 2617 |
+
html_parts.append("""
|
| 2618 |
+
<div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; margin-top: 20px;">
|
| 2619 |
+
""")
|
| 2620 |
+
|
| 2621 |
+
# Render each card
|
| 2622 |
+
for card_id, info in catalog.items():
|
| 2623 |
+
# Render card preview
|
| 2624 |
+
card_preview = render_card_html(card_id, info, primary, secondary, accent)
|
| 2625 |
+
|
| 2626 |
+
# Complexity color
|
| 2627 |
+
complexity = info.get('complexity', 'simple')
|
| 2628 |
+
if complexity == "simple":
|
| 2629 |
+
complexity_color = "#28a745"
|
| 2630 |
+
elif complexity == "medium":
|
| 2631 |
+
complexity_color = "#ffc107"
|
| 2632 |
+
else:
|
| 2633 |
+
complexity_color = "#dc3545"
|
| 2634 |
+
|
| 2635 |
+
html_parts.append(f"""
|
| 2636 |
+
<div style="background: white; padding: 16px; border-radius: 8px; border: 1px solid #dee2e6; display: flex; flex-direction: column; gap: 12px; align-items: center;">
|
| 2637 |
+
{card_preview}
|
| 2638 |
+
<div style="width: 100%; text-align: center;">
|
| 2639 |
+
<div style="font-weight: 600; font-size: 13px; margin-bottom: 4px;">{info['name']}</div>
|
| 2640 |
+
<div style="font-size: 10px; color: #6c757d; margin-bottom: 6px;">
|
| 2641 |
+
<code style="background: #e9ecef; padding: 2px 6px; border-radius: 3px; font-size: 9px;">{card_id}</code>
|
| 2642 |
+
</div>
|
| 2643 |
+
<div style="font-size: 10px; color: #6c757d; margin-bottom: 6px;">{info['description']}</div>
|
| 2644 |
+
<span style="background: {complexity_color}; color: white; padding: 2px 8px; border-radius: 10px; font-size: 9px; font-weight: 600;">
|
| 2645 |
+
{complexity.upper()}
|
| 2646 |
+
</span>
|
| 2647 |
+
</div>
|
| 2648 |
+
</div>
|
| 2649 |
+
""")
|
| 2650 |
+
|
| 2651 |
+
html_parts.append("</div></div>")
|
| 2652 |
+
return "".join(html_parts)
|
| 2653 |
+
|
| 2654 |
+
|
| 2655 |
def generate_single_background_preview(bg_id: str):
|
| 2656 |
"""
|
| 2657 |
Generate preview code for a single background
|
|
|
|
| 3171 |
outputs=[footer_gallery_html]
|
| 3172 |
)
|
| 3173 |
|
| 3174 |
+
# Card Gallery Section
|
| 3175 |
+
gr.Markdown("---")
|
| 3176 |
+
with gr.Accordion("π΄ Card Catalog (30 Card Types)", open=False):
|
| 3177 |
+
gr.Markdown("""
|
| 3178 |
+
Tutte le 30 tipologie di cards renderizzate in HTML/CSS.
|
| 3179 |
+
Product, Profile, Social, Content, Stats, Messaging, Special - tutte con i tuoi colori del tema.
|
| 3180 |
+
""")
|
| 3181 |
+
|
| 3182 |
+
# Refresh button to update with new theme
|
| 3183 |
+
refresh_cards_btn = gr.Button("π Aggiorna Cards con Tema Corrente", variant="secondary", size="sm")
|
| 3184 |
+
|
| 3185 |
+
# Card Gallery HTML - show immediately with default theme
|
| 3186 |
+
card_gallery_html = gr.HTML(
|
| 3187 |
+
value=generate_card_gallery(default_theme_for_gallery)
|
| 3188 |
+
)
|
| 3189 |
+
|
| 3190 |
+
# Connect refresh button
|
| 3191 |
+
refresh_cards_btn.click(
|
| 3192 |
+
fn=generate_card_gallery,
|
| 3193 |
+
inputs=[theme_json_input],
|
| 3194 |
+
outputs=[card_gallery_html]
|
| 3195 |
+
)
|
| 3196 |
+
|
| 3197 |
|
| 3198 |
# Connect button
|
| 3199 |
generate_flutter_btn.click(
|