mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 12:33:03 +00:00
break down foldername into subpaths
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { subPath } from "@/interfaces";
|
||||
|
||||
/**
|
||||
* Breaks a path into sub-paths.
|
||||
* @param {string} paths to break into subpaths
|
||||
* @returns {subPath[]} an array of subpaths
|
||||
*/
|
||||
export default function createSubPaths(paths: string | string[]): subPath[] {
|
||||
const pathlist = (paths as string).split("/");
|
||||
pathlist.shift();
|
||||
|
||||
const subPaths = pathlist.map((path, index) => {
|
||||
return { name: path, path: pathlist.slice(0, index + 1).join("/") };
|
||||
});
|
||||
|
||||
return subPaths;
|
||||
}
|
||||
@@ -24,3 +24,14 @@ export enum ContextSrc {
|
||||
AHeader = "AHeader",
|
||||
FHeader = "FHeader"
|
||||
}
|
||||
|
||||
export enum Routes {
|
||||
home = "Home",
|
||||
folder = "FolderView",
|
||||
playlists = "Playlists",
|
||||
playlist = "PlaylistView",
|
||||
albums = "AlbumsView",
|
||||
album = "AlbumView",
|
||||
artists = "ArtistsView",
|
||||
settings = "SettingsView",
|
||||
}
|
||||
Reference in New Issue
Block a user