Skip to content

Commit

Permalink
[ui] Rename profile 'Detailed' to 'All'
Browse files Browse the repository at this point in the history
  • Loading branch information
hhssb committed Dec 16, 2024
1 parent ba517a3 commit b2c4507
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions app/src/app/search/components/column-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ export function ColumnSelector({
<span>Regular</span>
</CommandItem>
<CommandItem
onSelect={() => setProfile("Detailed")}
value="Detailed"
onSelect={() => setProfile("All")}
value="All"
className="space-x-2"
>
<Check
size={14}
className={
profiles && isEqual(columns, profiles["Detailed"])
profiles && isEqual(columns, profiles["All"])
? "opacity-100"
: "opacity-0"
}
/>
<span>Detailed</span>
<span>All</span>
</CommandItem>
</CommandGroup>
</CommandList>
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/search/search.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export interface SetQuery {
export type SearchAction = SetQuery | ResetAll | SetOrder | SetPage;
// Define TableColumnVisibilityType with string literals
export type TableColumnVisibilityType = 'Adaptable' | 'Always';
export type ColumnProfile = 'Brief' | 'Regular' | 'Detailed';
export type ColumnProfile = "Brief" | "Regular" | "All";

export type TableColumnCode = 'name' | 'activity_section' | 'activity' | 'top_region' | 'region' | 'statistic' | 'unit_counts' | 'sector' | 'data_sources';

Expand Down
32 changes: 16 additions & 16 deletions app/src/app/search/table-columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ export function TableColumnsProvider({ children }: { children: ReactNode }) {
visible: statDefinition.priority! <= 1,
profiles:
statDefinition.priority === 1
? ["Brief", "Regular", "Detailed"]
? ["Brief", "Regular", "All"]
: statDefinition.priority === 2
? ["Regular", "Detailed"]
: ["Detailed"],
? ["Regular", "All"]
: ["All"],
}) as AdaptableTableColumn
);

Expand All @@ -72,31 +72,31 @@ export function TableColumnsProvider({ children }: { children: ReactNode }) {
label: "Activity Section",
visible: true,
stat_code: null,
profiles: ["Brief", "Detailed"],
profiles: ["Brief", "All"],
},
{
type: "Adaptable",
code: "activity",
label: "Activity",
visible: false,
stat_code: null,
profiles: ["Regular", "Detailed"],
profiles: ["Regular", "All"],
},
{
type: "Adaptable",
code: "top_region",
label: "Top Region",
visible: true,
stat_code: null,
profiles: ["Brief", "Detailed"],
profiles: ["Brief", "All"],
},
{
type: "Adaptable",
code: "region",
label: "Region",
visible: false,
stat_code: null,
profiles: ["Regular", "Detailed"],
profiles: ["Regular", "All"],
},
...statisticColumns,
{
Expand All @@ -105,23 +105,23 @@ export function TableColumnsProvider({ children }: { children: ReactNode }) {
label: "Unit Counts",
visible: false,
stat_code: null,
profiles: ["Detailed"],
profiles: ["All"],
},
{
type: "Adaptable",
code: "sector",
label: "Sector",
visible: false,
stat_code: null,
profiles: ["Detailed"],
profiles: ["All"],
},
{
type: "Adaptable",
code: "data_sources",
label: "Data Source",
visible: false,
stat_code: null,
profiles: ["Detailed"],
profiles: ["All"],
},
];
}
Expand Down Expand Up @@ -156,7 +156,7 @@ export function TableColumnsProvider({ children }: { children: ReactNode }) {

// Try loading from localStorage first
try {
const saved = localStorage.getItem(COLUMN_LOCALSTORAGE_NAME);
const saved = localStorage.getItem(COLUMN_LOCALSTORAGE_NAME);
const savedColumns = saved ? JSON.parse(saved) : [];
const currentColumns = updateColumnsWithPreferences(savedColumns);
setColumns(currentColumns);
Expand All @@ -166,9 +166,9 @@ export function TableColumnsProvider({ children }: { children: ReactNode }) {
JSON.stringify(currentColumns)
);
}
} catch (e) {
console.error("Failed to parse stored columns state:", e);
localStorage.removeItem(COLUMN_LOCALSTORAGE_NAME);
} catch (e) {
console.error("Failed to parse stored columns state:", e);
localStorage.removeItem(COLUMN_LOCALSTORAGE_NAME);
setColumns(fallbackColumns);
}

Expand Down Expand Up @@ -267,11 +267,11 @@ export function TableColumnsProvider({ children }: { children: ReactNode }) {
visible: col.profiles.includes("Regular"),
}),
})),
Detailed: columns.map((col) => ({
All: columns.map((col) => ({
...col,
...(col.type === "Adaptable" &&
"profiles" in col && {
visible: col.profiles.includes("Detailed"),
visible: col.profiles.includes("All"),
}),
})),
}),
Expand Down

0 comments on commit b2c4507

Please sign in to comment.