Skip to content

Commit 4b67c63

Browse files
Add marker to SiS versions
1 parent e8e640f commit 4b67c63

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

components/blocks/autofunction.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const cleanHref = (name) => {
2828
const Autofunction = ({
2929
version,
3030
versions,
31+
snowflakeVersions,
3132
streamlitFunction,
3233
streamlit,
3334
exceptions,
@@ -103,6 +104,7 @@ const Autofunction = ({
103104

104105
const VersionSelector = ({
105106
versionList,
107+
snowflakeVersions,
106108
currentVersion,
107109
handleSelectVersion,
108110
}) => {
@@ -124,11 +126,9 @@ const Autofunction = ({
124126
>
125127
{versionList.map((version, index) => (
126128
<option value={version} key={version}>
127-
{version == "SiS"
128-
? "Streamlit in Snowflake"
129-
: version.startsWith("SiS.")
130-
? version.replace("SiS.", "Streamlit in Snowflake ")
131-
: "Version " + version}
129+
{snowflakeVersions.includes(version)
130+
? version + " (SiS)"
131+
: version}
132132
</option>
133133
))}
134134
</select>
@@ -224,6 +224,7 @@ const Autofunction = ({
224224
</H2>
225225
<VersionSelector
226226
versionList={versionList}
227+
snowflakeVersions={snowflakeVersions}
227228
currentVersion={currentVersion}
228229
handleSelectVersion={handleSelectVersion}
229230
/>
@@ -292,6 +293,7 @@ const Autofunction = ({
292293
{headerTitle}
293294
<VersionSelector
294295
versionList={versionList}
296+
snowflakeVersions={snowflakeVersions}
295297
currentVersion={currentVersion}
296298
handleSelectVersion={handleSelectVersion}
297299
/>

components/blocks/autofunction.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,7 @@
175175
:global(.dark) .Keyword::after {
176176
@apply bg-gray-80 text-gray-30;
177177
}
178+
179+
.Snowflake::after {
180+
content: "SiS";
181+
}

pages/[...slug].js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export default function Article({
8484
nextMenuItem,
8585
versionFromStaticLoad,
8686
versions,
87+
snowflakeVersions,
8788
filename,
8889
}) {
8990
let versionWarning;
@@ -156,6 +157,7 @@ export default function Article({
156157
exceptions={exceptions}
157158
version={version}
158159
versions={versions}
160+
snowflakeVersions={snowflakeVersions}
159161
slug={slug}
160162
oldStreamlitFunction={props.oldName ?? ""}
161163
/>
@@ -356,6 +358,7 @@ export async function getStaticProps(context) {
356358
props["streamlit"] = {};
357359
props["exceptions"] = {};
358360
props["versions"] = all_versions;
361+
props["snowflakeVersions"] = [];
359362
props["versionFromStaticLoad"] = null;
360363

361364
if ("slug" in context.params) {
@@ -375,6 +378,7 @@ export async function getStaticProps(context) {
375378
if (should_version) {
376379
props["streamlit"] = streamlitFuncs[current_version];
377380
props["exceptions"] = streamlitExceptions[current_version] ?? {};
381+
props["snowflakeVersions"] = Object.keys(streamlitExceptions);
378382
}
379383

380384
const isnum = /^[\d\.]+$/.test(context.params.slug[0]);

0 commit comments

Comments
 (0)