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 Icon from "astro-iconify";
import { featureFlags, featureLabels } from "../utils/feature-flags"; import { featureFlags } from "../utils/feature-flags";
export interface Props { export interface Props {
toggle: string; toggle: string;
} }
@ -29,12 +29,12 @@ const { toggle } = Astro.props;
id={`settings-${index}`} id={`settings-${index}`}
name={`settings-${index}`} name={`settings-${index}`}
/> />
<label for={`settings-${index}`}>{featureLabels[settings]}</label> <label for={`settings-${index}`}>{settings}</label>
</div> </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> </form>
<style lang="scss"> <style lang="scss">
@ -66,6 +66,7 @@ const { toggle } = Astro.props;
} }
.field { .field {
margin-left: 0.5em; margin-left: 0.5em;
margin-bottom: 0.5em;
} }
} }
</style> </style>

View file

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