dylanebert HF staff commited on
Commit
2310af8
1 Parent(s): 9f36e54

coming soon label

Browse files
Files changed (1) hide show
  1. src/routes/ModelDetails.svelte +20 -4
src/routes/ModelDetails.svelte CHANGED
@@ -51,6 +51,15 @@
51
  scenes = [...scenes];
52
  }
53
 
 
 
 
 
 
 
 
 
 
54
  onMount(fetchScenes);
55
  </script>
56
 
@@ -66,9 +75,9 @@
66
  </div>
67
 
68
  <div class="model-details">
69
- {#if config && (config.Model || config.Space || config.Paper)}
70
  <div class="config-container">
71
- {#if config.Model}
72
  <div class="config-item">
73
  <span class="config-label">Model:</span>
74
  <a class="muted" href={config.Model} target="_blank">
@@ -76,7 +85,7 @@
76
  </a>
77
  </div>
78
  {/if}
79
- {#if config.Space}
80
  <div class="config-item">
81
  <span class="config-label">Space:</span>
82
  <a class="muted" href={config.Space} target="_blank">
@@ -84,7 +93,7 @@
84
  </a>
85
  </div>
86
  {/if}
87
- {#if config.Paper}
88
  <div class="config-item">
89
  <span class="config-label">Paper:</span>
90
  <a class="muted" href={config.Paper} target="_blank">
@@ -96,6 +105,13 @@
96
  </div>
97
  {/if}
98
  </div>
 
 
 
 
 
 
 
99
  {/if}
100
 
101
  {#if scenes.length > 0}
 
51
  scenes = [...scenes];
52
  }
53
 
54
+ function isValidUrl(url: string): boolean {
55
+ try {
56
+ new URL(url);
57
+ return true;
58
+ } catch (error) {
59
+ return false;
60
+ }
61
+ }
62
+
63
  onMount(fetchScenes);
64
  </script>
65
 
 
75
  </div>
76
 
77
  <div class="model-details">
78
+ {#if config && (isValidUrl(config.Model) || isValidUrl(config.Space) || isValidUrl(config.Paper))}
79
  <div class="config-container">
80
+ {#if config.Model && isValidUrl(config.Model)}
81
  <div class="config-item">
82
  <span class="config-label">Model:</span>
83
  <a class="muted" href={config.Model} target="_blank">
 
85
  </a>
86
  </div>
87
  {/if}
88
+ {#if config.Space && isValidUrl(config.Space)}
89
  <div class="config-item">
90
  <span class="config-label">Space:</span>
91
  <a class="muted" href={config.Space} target="_blank">
 
93
  </a>
94
  </div>
95
  {/if}
96
+ {#if config.Paper && isValidUrl(config.Paper)}
97
  <div class="config-item">
98
  <span class="config-label">Paper:</span>
99
  <a class="muted" href={config.Paper} target="_blank">
 
105
  </div>
106
  {/if}
107
  </div>
108
+ {:else}
109
+ <div class="config-container">
110
+ <div class="config-item">
111
+ <span class="config-label">Model:</span>
112
+ <span class="muted">Coming Soon</span>
113
+ </div>
114
+ </div>
115
  {/if}
116
 
117
  {#if scenes.length > 0}