Skip to content

Commit

Permalink
enables permanently feature splitting and CSV upload
Browse files Browse the repository at this point in the history
  • Loading branch information
agnlez committed Dec 14, 2023
1 parent c9968dc commit d306fc8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 23 deletions.
2 changes: 0 additions & 2 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with
- `NEXT_PUBLIC_FEATURE_FLAGS` (comma-separated list of feature flag strings,
optional, default is an empty list): list features here in order to _enable_
them in the frontend app; features available behind feature flags are:
- `split`: make _split_ functionality available for conservation features in
the frontend app
- `strat`: make _stratification_ functionality available for conservation
features in the frontend app

Expand Down
8 changes: 4 additions & 4 deletions app/components/features/selected-item/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const Item: React.FC<ItemProps> = ({
}: ItemProps) => {
const [splitOpen, setSplitOpen] = useState(!!splitSelected);

const { split, strat } = useFeatureFlags();
const { strat } = useFeatureFlags();

// EVENTS
const onSplitChanged = useCallback(
Expand Down Expand Up @@ -137,7 +137,7 @@ export const Item: React.FC<ItemProps> = ({
<h2 className="font-heading text-sm">{name}</h2>

<div className="mr-3 flex space-x-2">
{editable && split && !!OPTIONS.length && (
{editable && !!OPTIONS.length && (
<Tooltip
arrow
placement="top"
Expand Down Expand Up @@ -204,7 +204,7 @@ export const Item: React.FC<ItemProps> = ({
</div>
</div>

{split && splitOpen && (
{splitOpen && (
<div>
<div className="mt-3 flex items-center space-x-2 font-heading tracking-wide">
<h4 className="text-xxs uppercase text-white">
Expand Down Expand Up @@ -299,7 +299,7 @@ export const Item: React.FC<ItemProps> = ({
)}
</header>

{splitSelected && split && splitOpen && (
{splitSelected && splitOpen && (
<ul className="pl-3">
{splitFeaturesOptions.map((f) => {
const checked =
Expand Down
28 changes: 11 additions & 17 deletions app/components/upload-tabs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';

import { useFeatureFlags } from 'hooks/feature-flags';

import { cn } from 'utils/cn';

const BUTTON_COMMON_CLASSES =
Expand All @@ -18,8 +16,6 @@ export const UploadFeatureTabs = ({
mode: UploadFeatureMode;
onChange: (mode: UploadFeatureMode) => void;
}): JSX.Element => {
const { CSVUpload } = useFeatureFlags();

return (
<div className="flex w-full space-x-4 border-b border-gray-400 text-xs font-medium text-black">
<button
Expand All @@ -34,19 +30,17 @@ export const UploadFeatureTabs = ({
Shapefile
</button>

{CSVUpload && (
<button
type="button"
className={cn({
[BUTTON_COMMON_CLASSES]: true,
[BUTTON_ACTIVE_CLASSES]: mode === 'csv',
[BUTTON_INACTIVE_CLASSES]: mode !== 'csv',
})}
onClick={() => onChange('csv')}
>
CSV
</button>
)}
<button
type="button"
className={cn({
[BUTTON_COMMON_CLASSES]: true,
[BUTTON_ACTIVE_CLASSES]: mode === 'csv',
[BUTTON_INACTIVE_CLASSES]: mode !== 'csv',
})}
onClick={() => onChange('csv')}
>
CSV
</button>
</div>
);
};
Expand Down

0 comments on commit d306fc8

Please sign in to comment.