mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
Feature/marketplace redesign (#2395)
* wip * update marketplace categories styling * update logo icons * add sort pipe * update search component styling * clean up categories component * cleanup and remove unnecessary sort pipe * query packages in selected category * fix search styling * add reg icon and font, adjust category styles * fix build from rebasing integration/refactors * adjust marketplace types for icon with store data, plus formatting * formatting * update categories and search * hover styling for categories * category styling * refactor for category as a behavior subject * more category styling * base functionality with new marketplace components * styling cleanup * misc style fixes and fix category selection from package page * fixes from review feedback * add and style additional details * implement release notes modal * fix menu when on service show page mobile to display change marketplace * style and responsiveness fixes * rename header to sidebar * input icon config to sidebar * add mime type pipe and type fn * review feedback fixes * skeleton text, more abstraction * reorder categories, clean up a little * audit sidebar, categories, store-icon, marketplace-sidebar, search * finish code cleanup and fix few bugs * misc fixes and cleanup * fix broken styles and markdown * bump shared marketplace version * more cleanup * sync package lock * rename sidebar component to menu * wip preview sidebar * sync package lock * breakout package show elements into components * link to brochure in preview; custom taiga button styles * move marketplace preview component into ui; open preview when viewing service in marketplace * sync changes post file struture rename * further cleanup * create service for sidebar toggle and cleanup marketplace components * bump shared marketplace version * bump shared for new images needed for brochure marketplace * cleanup --------- Co-authored-by: Matt Hill <mattnine@protonmail.com>
This commit is contained in:
34
web/projects/shared/src/pipes/shared/sort.pipe.ts
Normal file
34
web/projects/shared/src/pipes/shared/sort.pipe.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
|
||||
@Pipe({
|
||||
name: 'sort',
|
||||
})
|
||||
export class SortPipe implements PipeTransform {
|
||||
transform(
|
||||
value: any[],
|
||||
column: string = '',
|
||||
direction: string = 'asc',
|
||||
): any[] {
|
||||
// If the value is not an array or is empty, return the original value
|
||||
if (!Array.isArray(value) || value.length === 0) {
|
||||
return value
|
||||
}
|
||||
|
||||
// Clone the array to avoid modifying the original value
|
||||
const sortedValue = [...value]
|
||||
|
||||
// Define the sorting function based on the column and direction parameters
|
||||
const sortingFn = (a: any, b: any): number => {
|
||||
if (a[column] < b[column]) {
|
||||
return direction === 'asc' ? -1 : 1
|
||||
} else if (a[column] > b[column]) {
|
||||
return direction === 'asc' ? 1 : -1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the array and return the result
|
||||
return sortedValue.sort(sortingFn)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user