From 1bf07892f2cd8007f48469c42fa9fcc84d5ef435 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sat, 17 Apr 2021 13:39:30 +0300
Subject: feat: correctly add filters from Service JSON

---
 src/containers/Page.tsx | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

(limited to 'src/containers/Page.tsx')

diff --git a/src/containers/Page.tsx b/src/containers/Page.tsx
index 2fe54fa..d659510 100644
--- a/src/containers/Page.tsx
+++ b/src/containers/Page.tsx
@@ -1,8 +1,13 @@
 import React from 'react';
 import Paper from '../components/Paper';
 import Button from '../components/Button';
-import { Action, Filter } from '../lib/ServiceContext';
-import { SelectBase } from '../components/Select';
+import { Action } from '../lib/ServiceContext';
+import { Option, SelectBase } from '../components/Select';
+import { Field } from '../components/ListTable';
+
+export interface Filter extends Field {
+  options?: Option[];
+}
 
 interface Props {
   title?: string;
@@ -19,8 +24,8 @@ const Page: React.FC<Props> = ({ title, actions, filters, className, children })
       <div className={`${style} ${(actions?.length || 0) > 1 ? 'flex-col items-start' : 'flex-row items-center'}`}>
         <span className="text-2xl font-bold">{title}</span>
         <div className="flex">
-          <div className="mr-6">
-            {filters?.map(filter => (<SelectBase key={filter.field} options={filter.options} />))}
+          <div className="mr-6 flex">
+            {filters?.map(filter => (<SelectBase key={filter.key} options={filter.options || []} />))}
           </div>
           <div>
             {actions?.map(action => (<Button {...action} key={action.name} size="sm">{action.name}</Button>))}
-- 
cgit v1.2.3

