This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export interface CustomEvent { | |
| key: string; | |
| payload: unknown; | |
| } | |
| @Injectable({ providedIn: 'root' }) | |
| export class EventBusService { | |
| private eventsSubject = new Subject<CustomEvent>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** tailwind.directive.ts */ | |
| import { Directive, HostBinding, Input } from '@angular/core' | |
| import { APP_TAILWIND_STYLES } from '@core/values/styles' | |
| @Directive({ | |
| selector: '[tailwind]', | |
| }) | |
| export class TailwindDirective { | |
| private twClasses = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const APP_TAILWIND_STYLES: { [key: string]: string } = { | |
| button: ` | |
| hover:bg-indigo-500 | |
| px-6 py-2 | |
| tracking-wider | |
| text-indigo-50 | |
| uppercase | |
| bg-indigo-400 | |
| rounded | |
| `, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Directive, HostBinding, Input } from '@angular/core' | |
| import { APP_TAILWIND_STYLES } from '@core/values/styles' | |
| @Directive({ | |
| selector: '[tailwind]', | |
| }) | |
| export class TailwindDirective { | |
| private twClasses = '' | |
| @HostBinding('class') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div tailwind="layoutCenter" class="py-12"> | |
| <button [tailwind]="'button buttonSecondary'">My Button</button> | |
| <!-- or --> | |
| <button tailwind="button buttonSecondary">My Button</button> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@angular/core' | |
| import { environment } from '@environment/environment' | |
| import { AuthChangeEvent, createClient, Session, SupabaseClient } from '@supabase/supabase-js' | |
| @Injectable({ | |
| providedIn: 'root', | |
| }) | |
| export class SupabaseService { | |
| private supabase: SupabaseClient |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export type FilterOperator = | |
| | 'eq' | 'neq' | |
| | 'gt' | 'gte' | |
| | 'lt' | 'lte' | |
| | 'like' | 'ilike' | |
| | 'is' | 'in' | |
| | 'cs' | 'cd' | |
| | 'sl' | 'sr' | |
| | 'nxl' | 'nxr' | |
| | 'adj' | 'ov' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class BaseService<T> { | |
| protected resource: string // table name | |
| constructor(protected supabase: SupabaseService, resource: string) { | |
| this.resource = resource | |
| } | |
| findById(id: number, select = '*'): Observable<T> { | |
| const query = this.supabase.table(this.resource).select(select).match({ id }).single() | |
| return from(query).pipe(map((res) => res.body as T)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@angular/core' | |
| import { BaseService } from '@core/services/base.service' | |
| import { SupabaseService } from '@core/services/supabase.service' | |
| import { Product } from '@features/products/types/product' | |
| const TABLE_PRODUCT = 'products' | |
| @Injectable({ | |
| providedIn: 'root', | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Directive, ElementRef, HostListener, Input } from "@angular/core"; | |
| @Directive({ | |
| selector: "[appTextareaAutosize]" | |
| }) | |
| export class TextareaAutosizeDirective { | |
| @Input() minRows = 2; | |
| @Input() maxRows = 4; | |
| private offsetHeight = 0; |