File size: 1,354 Bytes
c939d66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Shared UI components for consistent styling across all apps.

Provides reusable layout components: navbar links and footer.
"""

import gradio as gr

# Support both local and HF Spaces imports
try:
    from config.app_registry import APPS_REGISTRY, get_app_info, get_all_apps
    from config.settings import get_app_url
except ImportError:
    import sys
    sys.path.insert(0, "/app")
    from config.app_registry import APPS_REGISTRY, get_app_info, get_all_apps
    from config.settings import get_app_url


def get_navbar_links(current_app_id: str) -> list[tuple[str, str]]:
    """
    Generate navbar links for cross-app navigation.

    Args:
        current_app_id: Current app's ID (excluded from links)

    Returns:
        List of (name, url) tuples for other apps
    """
    links = []
    for app_id in get_all_apps():
        if app_id != current_app_id:
            app_info = get_app_info(app_id)
            if app_info:
                url = get_app_url(app_id)
                if url:
                    links.append((app_info["name"], url))
    return links


def create_footer() -> gr.Markdown:
    """
    Create a standard footer component.

    Returns:
        gr.Markdown component
    """
    return gr.Markdown(
        """
---
**Powered by Lyzr** | [lyzr.ai](https://lyzr.ai)
""",
        elem_classes=["footer"]
    )