Skip to content

Commit

Permalink
chore: refactor photo-input to standalone component
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismclarke committed Jun 27, 2024
1 parent e2f5d5f commit 7912936
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,29 @@ import { PicsaTranslateModule } from '@picsa/shared/modules';

// Local components
import { FarmerActivityMaterialModule } from './material.module';
import { PhotoInputComponent } from './photo-input/photo-input.component';
import { PicsaPhotoInputComponent } from './photo-input/photo-input.component';

const Components = [PhotoInputComponent];
const Components = [];

@NgModule({
imports: [
CommonModule,
FormsModule,
PicsaCommonComponentsModule,
PicsaPhotoInputComponent,
PicsaTranslateModule,
PicsaVideoPlayerModule,
ReactiveFormsModule,
RouterModule,
FarmerActivityMaterialModule,
],
exports: [...Components, PicsaCommonComponentsModule, FarmerActivityMaterialModule, PicsaVideoPlayerModule],
exports: [
FarmerActivityMaterialModule,
PicsaCommonComponentsModule,
PicsaPhotoInputComponent,
PicsaVideoPlayerModule,
...Components,
],
declarations: [Components],
providers: [],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import { CommonModule } from '@angular/common';
import { Component, ElementRef, ViewChild } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import { Capacitor } from '@capacitor/core';
import { PicsaTranslateModule } from '@picsa/shared/modules';

import { PhotoService } from '../../services/photo-input.service';
import { PhotoService } from './photo-input.service';

interface Photo {
webPath?: string;
}

@Component({
selector: 'farmer-activity-photo-input',
selector: 'picsa-photo-input',
templateUrl: './photo-input.component.html',
styleUrls: ['./photo-input.component.scss'],
standalone: true,
imports: [CommonModule, MatButtonModule, MatIconModule, PicsaTranslateModule],
})
export class PhotoInputComponent {
export class PicsaPhotoInputComponent {
@ViewChild('fileInput') fileInput: ElementRef;
photos: Photo[] = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h2 *ngIf="videoUri">{{ videoResource.title | translate }}</h2>
{{ 'Activity' | translate }}
</ng-template>
<div class="tab-content">
<farmer-activity-photo-input />
<picsa-photo-input />
</div>
</mat-tab>

Expand Down

0 comments on commit 7912936

Please sign in to comment.