| 
1 | 1 | <script lang="ts">  | 
2 | 2 |     import { page } from '$app/state';  | 
3 |  | -    import { Submit, trackEvent, trackError } from '$lib/actions/analytics';  | 
 | 3 | +    import { trackEvent, trackError } from '$lib/actions/analytics';  | 
4 | 4 |     import { Modal, CustomId } from '$lib/components';  | 
5 | 5 |     import { subNavigation } from '$lib/stores/database';  | 
6 | 6 |     import { ID } from '@appwrite.io/console';  | 
 | 
11 | 11 |         tableColumnSuggestions  | 
12 | 12 |     } from '$database/(suggestions)/index';  | 
13 | 13 | 
  | 
14 |  | -    import { useTerminology } from '../helpers';  | 
 | 14 | +    import { getTerminologies } from '../helpers';  | 
15 | 15 | 
  | 
16 | 16 |     let {  | 
17 | 17 |         show = $bindable(false),  | 
 | 
23 | 23 |         onCreateEntity: (id: string, name: string) => Promise<void>;  | 
24 | 24 |     } = $props();  | 
25 | 25 | 
  | 
26 |  | -    const entity = $derived(useTerminology(page).entity);  | 
27 |  | -    const lower = $derived(entity.lower.singular);  | 
28 |  | -    const title = $derived(entity.title.singular);  | 
 | 26 | +    const { analytics, terminology } = getTerminologies();  | 
 | 27 | +
  | 
 | 28 | +    const lower = terminology.entity.lower.singular;  | 
 | 29 | +    const title = terminology.entity.title.singular;  | 
 | 30 | +    const analyticsCreateSubmit = analytics.submit.entity('Create');  | 
29 | 31 | 
  | 
30 | 32 |     // example - `table-[table]`, `collection-[collection]`  | 
31 | 33 |     const isOnEntitiesPage = $derived(page.route?.id.endsWith(`${lower}-[${lower}]`));  | 
 | 
65 | 67 |             updateAndCleanup();  | 
66 | 68 |         } catch (e) {  | 
67 | 69 |             error = e.message;  | 
68 |  | -            trackError(e, Submit.TableCreate);  | 
 | 70 | +            trackError(e, analyticsCreateSubmit);  | 
69 | 71 |         }  | 
70 | 72 |     }  | 
71 | 73 | 
  | 
 | 
77 | 79 |             message: `${name} has been created`  | 
78 | 80 |         });  | 
79 | 81 | 
  | 
80 |  | -        trackEvent(Submit.TableCreate, { customId: !!id });  | 
 | 82 | +        trackEvent(analyticsCreateSubmit, { customId: !!id });  | 
81 | 83 | 
  | 
82 | 84 |         // reset vars!  | 
83 | 85 |         name = id = null;  | 
 | 
0 commit comments