-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3730847
commit 4dfec18
Showing
19 changed files
with
775 additions
and
222 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-argument */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
"use client"; | ||
|
||
import { Position } from "@xyflow/react"; | ||
import NodeHandle from "../Primitives/NodeHandle"; | ||
|
||
import React from "react"; | ||
import { Separator } from "~/components/ui/separator"; | ||
import useBasicNodeState from "~/hooks/useBasicNodeState"; | ||
import { CardWithHeader } from "../Primitives/Card"; | ||
import Debug from "../Primitives/Debug"; | ||
import { SourceList } from "../Primitives/SourceList"; | ||
|
||
type PlaylistProps = { | ||
id: string; | ||
data: any; | ||
}; | ||
|
||
const RandomStream: React.FC<PlaylistProps> = ({ id, data }) => { | ||
const { state, isValid, targetConnections, sourceConnections } = | ||
useBasicNodeState(id); | ||
|
||
return ( | ||
<CardWithHeader | ||
title={`Push`} | ||
id={id} | ||
type="Combiner" | ||
status={isValid === null ? "loading" : isValid ? "success" : "error"} | ||
info="Selects a random stream from connected sources" | ||
> | ||
<NodeHandle | ||
type="source" | ||
position={Position.Right} | ||
style={{ background: "#555" }} | ||
/> | ||
<NodeHandle | ||
type="target" | ||
position={Position.Left} | ||
style={{ background: "#555" }} | ||
/> | ||
<div className="flex flex-col gap-4"> | ||
<SourceList state={state} isValid={isValid} operationType="Selecting from" /> | ||
<Separator /> | ||
<Debug | ||
id={id} | ||
isValid={isValid} | ||
TargetConnections={targetConnections} | ||
SourceConnections={sourceConnections} | ||
/> | ||
</div> | ||
</CardWithHeader> | ||
); | ||
}; | ||
|
||
export default RandomStream; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from "react"; | ||
import * as z from "zod"; | ||
import InputPrimitive from "../Primitives/Input"; | ||
import NodeBuilder from "../Primitives/NodeBuilder"; | ||
|
||
const formSchema = z.object({ | ||
albumId: z.string().min(1, { | ||
message: "Album ID is required.", | ||
}), | ||
limit: z.number().default(10), | ||
offset: z.number().default(0), | ||
}); | ||
|
||
const AlbumTracks: React.FC = ({ id, data }: any) => { | ||
return ( | ||
<NodeBuilder | ||
id={id} | ||
data={data} | ||
title="Album Tracks" | ||
type="Library" | ||
info="Get tracks from an album" | ||
formSchema={formSchema} | ||
handleConnectionType="both" | ||
formFields={({ form, register }) => ( | ||
<> | ||
<InputPrimitive | ||
control={form.control} | ||
name="albumId" | ||
inputType={"text"} | ||
label={"Album ID"} | ||
register={register} | ||
placeholder={"Album ID"} | ||
description={"The ID of the album to sort by popularity"} | ||
/> | ||
<InputPrimitive | ||
control={form.control} | ||
name="limit" | ||
inputType={"number"} | ||
label={"Limit"} | ||
register={register} | ||
placeholder={"10"} | ||
description={"The number of tracks to return"} | ||
/> | ||
<InputPrimitive | ||
control={form.control} | ||
name="offset" | ||
inputType={"number"} | ||
label={"Offset"} | ||
register={register} | ||
placeholder={"0"} | ||
description={"The offset to start at"} | ||
/> | ||
</> | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
export default AlbumTracks; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from "react"; | ||
import * as z from "zod"; | ||
import InputPrimitive from "../Primitives/Input"; | ||
import NodeBuilder from "../Primitives/NodeBuilder"; | ||
|
||
const formSchema = z.object({ | ||
artistsId: z.string().min(1, { | ||
message: "Album ID is required.", | ||
}), | ||
limit: z.number().default(10), | ||
offset: z.number().default(0), | ||
}); | ||
|
||
const ArtistsTopTracks: React.FC = ({ id, data }: any) => { | ||
return ( | ||
<NodeBuilder | ||
id={id} | ||
data={data} | ||
title="Artists Top Tracks" | ||
type="Library" | ||
info="Get tracks from an artists top tracks." | ||
formSchema={formSchema} | ||
handleConnectionType="both" | ||
formFields={({ form, register }) => ( | ||
<> | ||
<InputPrimitive | ||
control={form.control} | ||
name="artistId" | ||
inputType={"text"} | ||
label={"Artist ID"} | ||
register={register} | ||
placeholder={"Artist ID"} | ||
description={"The ID of the artist to get top tracks for"} | ||
/> | ||
<InputPrimitive | ||
control={form.control} | ||
name="limit" | ||
inputType={"number"} | ||
label={"Limit"} | ||
register={register} | ||
placeholder={"10"} | ||
description={"The number of tracks to return"} | ||
/> | ||
<InputPrimitive | ||
control={form.control} | ||
name="offset" | ||
inputType={"number"} | ||
label={"Offset"} | ||
register={register} | ||
placeholder={"0"} | ||
description={"The offset to start at"} | ||
/> | ||
</> | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
export default ArtistsTopTracks; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from "react"; | ||
import NodeBuilder from "../Primitives/NodeBuilder"; | ||
|
||
const Reverse: React.FC = ({ id, data }: any) => { | ||
|
||
return ( | ||
<NodeBuilder | ||
id={id} | ||
data={data} | ||
title="Reverse" | ||
type="Order" | ||
info="Reverses the order of tracks" | ||
handleConnectionType="both" | ||
/> | ||
); | ||
}; | ||
|
||
export default Reverse; |
Oops, something went wrong.