refactor: feature flags

This commit is contained in:
Ayo 2023-07-27 18:40:27 +02:00 committed by Ayo Ayco
parent 3b2a863b6c
commit 8eff875340
2 changed files with 7 additions and 14 deletions

View file

@ -1,6 +1,6 @@
---
import Icon from "astro-iconify";
import { featureFlags, featureLabels } from "../utils/feature-flags";
import { featureFlags } from "../utils/feature-flags";
export interface Props {
toggle: string;
}
@ -29,12 +29,12 @@ const { toggle } = Astro.props;
id={`settings-${index}`}
name={`settings-${index}`}
/>
<label for={`settings-${index}`}>{featureLabels[settings]}</label>
<label for={`settings-${index}`}>{settings}</label>
</div>
)
)
}
<small>This is where feature flags will be set once made available.</small>
<small>This is where feature flags will be set once made available. <a href="https://github.com/ayoayco/cozy/issues/new" target="_blank">Request features or report bugs here.</a></small>
</form>
<style lang="scss">
@ -66,6 +66,7 @@ const { toggle } = Astro.props;
}
.field {
margin-left: 0.5em;
margin-bottom: 0.5em;
}
}
</style>

View file

@ -1,14 +1,6 @@
export enum Features {
"SendToEmail",
"HideImages",
}
export const featureLabels: Record<Features, string> = {
[Features.SendToEmail]: "Send to email",
[Features.HideImages]: "Hide images",
};
export type Features = 'Send to Email' | 'Hide Images';
export const featureFlags: Record<Features, boolean> = {
[Features.SendToEmail]: false,
[Features.HideImages]: false,
'Send to Email': false,
'Hide Images': true,
};