@featurevisor/site 0.56.0 → 0.57.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@
2
2
  interface Tab {
3
3
  title: string;
4
4
  to: string;
5
+ end?: boolean;
5
6
  }
6
7
  interface TabsProps {
7
8
  tabs: Tab[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@featurevisor/site",
3
- "version": "0.56.0",
3
+ "version": "0.57.1",
4
4
  "description": "Static site for Featurevisor",
5
5
  "main": "dist",
6
6
  "scripts": {
@@ -63,7 +63,7 @@
63
63
  "webpack-merge": "^5.10.0"
64
64
  },
65
65
  "dependencies": {
66
- "@featurevisor/types": "^0.56.0"
66
+ "@featurevisor/types": "^0.57.0"
67
67
  },
68
- "gitHead": "cf164942d23745dbf52e8b68abbe7b153891ba11"
68
+ "gitHead": "7cc477b7ab7eef3d6db88249d0806db56b16fd2f"
69
69
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
 
3
- import { Routes, Route, redirect } from "react-router-dom";
3
+ import { Routes, Route, Navigate } from "react-router-dom";
4
4
 
5
5
  import { Header } from "./Header";
6
6
  import { Footer } from "./Footer";
@@ -63,9 +63,6 @@ export function App() {
63
63
  {fetchedSearchIndex && (
64
64
  <SearchIndexContext.Provider value={{ isLoaded: true, data: fetchedSearchIndex }}>
65
65
  <Routes>
66
- {/* @TODO: try redirecting to /features */}
67
- <Route path="/" element={<ListFeatures />} />
68
-
69
66
  <Route path="features">
70
67
  <Route index element={<ListFeatures />} />
71
68
 
@@ -75,23 +72,11 @@ export function App() {
75
72
  <Route path="variables" element={<DisplayFeatureVariablesSchema />} />
76
73
  <Route path="rules" element={<DisplayFeatureRules />}>
77
74
  <Route path=":environmentKey" element={<DisplayFeatureRulesTable />} />
78
- <Route
79
- path="*"
80
- loader={({ params }) =>
81
- /* @TODO: fix redirection */
82
- redirect(`/features/${params.featureKey}/rules/${environmentKeys[0]}`)
83
- }
84
- />
75
+ <Route index element={<Navigate to={environmentKeys[0]} replace />} />
85
76
  </Route>
86
77
  <Route path="force" element={<DisplayFeatureForce />}>
87
78
  <Route path=":environmentKey" element={<DisplayFeatureForceTable />} />
88
- <Route
89
- path="*"
90
- loader={({ params }) =>
91
- /* @TODO: fix redirection */
92
- redirect(`/features/${params.featureKey}/force/${environmentKeys[0]}`)
93
- }
94
- />
79
+ <Route index element={<Navigate to={environmentKeys[0]} replace />} />
95
80
  </Route>
96
81
  <Route path="history" element={<DisplayFeatureHistory />} />
97
82
  </Route>
@@ -118,6 +103,7 @@ export function App() {
118
103
  </Route>
119
104
 
120
105
  <Route path="history" element={<ListHistory />} />
106
+ <Route index element={<Navigate to="features" replace />} />
121
107
  </Routes>
122
108
  </SearchIndexContext.Provider>
123
109
  )}
@@ -208,51 +208,62 @@ export function DisplayFeatureRulesTable() {
208
208
  }
209
209
 
210
210
  return (
211
- <table className="mt-3 min-w-full divide-y divide-gray-300 border border-gray-200">
212
- <thead className="bg-gray-50">
213
- <tr>
214
- <th className="py-4 pl-4 pr-3 text-left text-sm font-semibold text-gray-500">
215
- Percentage
216
- </th>
217
- <th className="py-4 pl-4 pr-3 text-left text-sm font-semibold text-gray-500">Segments</th>
218
- <th className="py-4 pl-4 pr-3 text-left text-sm font-semibold text-gray-500">
219
- Variables
220
- </th>
221
- </tr>
222
- </thead>
223
-
224
- <tbody>
225
- {feature.environments[environmentKey].rules.map((rule, index) => {
226
- return (
227
- <tr key={index} className={index % 2 === 0 ? undefined : "bg-gray-50"}>
228
- <td className="py-4 pl-4 pr-3 text-sm text-gray-900">{rule.percentage}%</td>
229
- <td className="py-4 pl-4 pr-3 text-sm text-gray-900">
230
- <ExpandRuleSegments segments={rule.segments} />
231
- </td>
232
- <td className="py-4 pl-4 pr-3 text-sm text-gray-900">
233
- {rule.variables && (
234
- <ul className="list-inside list-disc">
235
- {Object.keys(rule.variables).map((k) => {
236
- return (
237
- <li key={k}>
238
- <span className="font-semibold">{k}</span>:{" "}
239
- {typeof rule.variables[k] === "string" && rule.variables[k]}
240
- {typeof rule.variables[k] !== "string" && (
241
- <code className="rounded bg-gray-100 px-2 py-1 text-red-400">
242
- {rule.variables[k]}
243
- </code>
244
- )}
245
- </li>
246
- );
247
- })}
248
- </ul>
249
- )}
250
- </td>
251
- </tr>
252
- );
253
- })}
254
- </tbody>
255
- </table>
211
+ <div>
212
+ {feature.environments[environmentKey].expose === false && (
213
+ <p className="mt-2 block rounded border-2 border-orange-300 bg-orange-200 p-3 text-sm text-gray-600">
214
+ Rules are not <a href="https://featurevisor.com/docs/features/#expose">exposed</a> in this
215
+ environment.
216
+ </p>
217
+ )}
218
+
219
+ <table className="mt-3 min-w-full divide-y divide-gray-300 border border-gray-200">
220
+ <thead className="bg-gray-50">
221
+ <tr>
222
+ <th className="py-4 pl-4 pr-3 text-left text-sm font-semibold text-gray-500">
223
+ Percentage
224
+ </th>
225
+ <th className="py-4 pl-4 pr-3 text-left text-sm font-semibold text-gray-500">
226
+ Segments
227
+ </th>
228
+ <th className="py-4 pl-4 pr-3 text-left text-sm font-semibold text-gray-500">
229
+ Variables
230
+ </th>
231
+ </tr>
232
+ </thead>
233
+
234
+ <tbody>
235
+ {feature.environments[environmentKey].rules.map((rule, index) => {
236
+ return (
237
+ <tr key={index} className={index % 2 === 0 ? undefined : "bg-gray-50"}>
238
+ <td className="py-4 pl-4 pr-3 text-sm text-gray-900">{rule.percentage}%</td>
239
+ <td className="py-4 pl-4 pr-3 text-sm text-gray-900">
240
+ <ExpandRuleSegments segments={rule.segments} />
241
+ </td>
242
+ <td className="py-4 pl-4 pr-3 text-sm text-gray-900">
243
+ {rule.variables && (
244
+ <ul className="list-inside list-disc">
245
+ {Object.keys(rule.variables).map((k) => {
246
+ return (
247
+ <li key={k}>
248
+ <span className="font-semibold">{k}</span>:{" "}
249
+ {typeof rule.variables[k] === "string" && rule.variables[k]}
250
+ {typeof rule.variables[k] !== "string" && (
251
+ <code className="rounded bg-gray-100 px-2 py-1 text-red-400">
252
+ {rule.variables[k]}
253
+ </code>
254
+ )}
255
+ </li>
256
+ );
257
+ })}
258
+ </ul>
259
+ )}
260
+ </td>
261
+ </tr>
262
+ );
263
+ })}
264
+ </tbody>
265
+ </table>
266
+ </div>
256
267
  );
257
268
  }
258
269
 
@@ -439,6 +450,7 @@ export function ShowFeature() {
439
450
  {
440
451
  title: "Overview",
441
452
  to: `/features/${featureKey}`,
453
+ end: true,
442
454
  },
443
455
  {
444
456
  title: "Variations",
@@ -4,6 +4,7 @@ import { NavLink } from "react-router-dom";
4
4
  interface Tab {
5
5
  title: string;
6
6
  to: string;
7
+ end?: boolean;
7
8
  }
8
9
 
9
10
  interface TabsProps {
@@ -20,7 +21,7 @@ export function Tabs(props: TabsProps) {
20
21
  <NavLink
21
22
  key={tab.title}
22
23
  to={tab.to}
23
- end
24
+ end={Boolean(tab.end)}
24
25
  className={({ isActive }) =>
25
26
  [
26
27
  "w-1/4",
@@ -67,7 +67,7 @@ export function isEnabledInEnvironment(feature: any, environment: string) {
67
67
  return false;
68
68
  }
69
69
 
70
- if (feature.environments[environment].exposed === false) {
70
+ if (feature.environments[environment].expose === false) {
71
71
  return false;
72
72
  }
73
73