From 2260b42d6fead3bf522aeeb2d1d65faa848591e7 Mon Sep 17 00:00:00 2001 From: Nidoxs Date: Mon, 9 Jun 2025 21:08:32 +0100 Subject: [PATCH 1/3] Add new scripts for installing and dev + dev project file --- dev.project.json | 17 +++++++++++++++++ scripts/dev.sh | 3 +++ scripts/install.sh | 4 ++++ 3 files changed, 24 insertions(+) create mode 100644 dev.project.json create mode 100644 scripts/dev.sh create mode 100644 scripts/install.sh diff --git a/dev.project.json b/dev.project.json new file mode 100644 index 0000000..8bb4f4b --- /dev/null +++ b/dev.project.json @@ -0,0 +1,17 @@ +{ + "name": "Freeway", + "tree": { + "$className": "DataModel", + + "ServerScriptService": { + "$className": "ServerScriptService", + + "Freeway": { + "$path": "src", + "Packages": { + "$path": "Packages" + } + } + } + } +} \ No newline at end of file diff --git a/scripts/dev.sh b/scripts/dev.sh new file mode 100644 index 0000000..dd8e5f4 --- /dev/null +++ b/scripts/dev.sh @@ -0,0 +1,3 @@ +rojo build dev.project.json --output build/freeway-plugin-dev.rbxl && +start build/freeway-plugin-dev.rbxl && +rojo serve dev.project.json \ No newline at end of file diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100644 index 0000000..f8b3d94 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,4 @@ +rm -rf sourcemap.json Packages && +wally install && +rojo sourcemap default.project.json >> sourcemap.json && +wally-package-types Packages --sourcemap sourcemap.json \ No newline at end of file From 8df39b2da9139bb711f489cb7b8de8fc478f7cc7 Mon Sep 17 00:00:00 2001 From: Nidoxs Date: Mon, 9 Jun 2025 21:08:40 +0100 Subject: [PATCH 2/3] Add to gitignore --- .gitignore | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8ea94f8..3a3fec5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,14 @@ /photoshop-integration.rbxlx # Roblox Studio lock files -/*.rbxlx.lock -/*.rbxl.lock +*.rbxl +*.rbxm +*.rbxmx +*.rbxlx.lock +*.rbxl.lock + +# build folder +build # Generated by Rojo, used for Luau Language Server sourcemap.json From 1bcac274e7c664f9870993fb98f811c8195d1155 Mon Sep 17 00:00:00 2001 From: Nidoxs Date: Mon, 9 Jun 2025 21:09:02 +0100 Subject: [PATCH 3/3] Create `AssetListEntry` temporary component --- src/Components/AssetListEntry.luau | 120 ++++++++++++++++++++++++++ src/Stories/AssetListEntry.story.luau | 64 ++++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 src/Components/AssetListEntry.luau create mode 100644 src/Stories/AssetListEntry.story.luau diff --git a/src/Components/AssetListEntry.luau b/src/Components/AssetListEntry.luau new file mode 100644 index 0000000..fa15c6b --- /dev/null +++ b/src/Components/AssetListEntry.luau @@ -0,0 +1,120 @@ +local Freeway = script:FindFirstAncestor("Freeway") +local React = require(Freeway.Packages.React) +local StudioComponents = require(Freeway.Packages.studiocomponents) + +local e = React.createElement + +local function AssetListEntry(props: { + Title: string, + Icon: string?, + Actions: { { Title: string, OnActivated: () -> (), ButtonStyle: ("MainButton" | "Button")? } }?, +}) + local actionButtons = {} + + if props.Actions then + for index, action in props.Actions do + local ButtonComponent = if action.ButtonStyle + then StudioComponents[action.ButtonStyle] or StudioComponents.Button + else StudioComponents.Button + + actionButtons[action.Title] = e(ButtonComponent, { + Text = action.Title, + OnActivated = action.OnActivated, + AutomaticSize = Enum.AutomaticSize.XY, + LayoutOrder = index, + }) + end + end + + return e("Frame", { + Position = UDim2.fromScale(0.5, 0.5), + AnchorPoint = Vector2.new(0.5, 0.5), + Size = UDim2.new(1, 0, 0, 40), + BackgroundTransparency = 1, + }, { + UICorner = e("UICorner", { + CornerRadius = UDim.new(0, 4), + }), + + UIPadding = e("UIPadding", { + PaddingLeft = UDim.new(0.005, 0), + PaddingRight = UDim.new(0.005, 0), + PaddingTop = UDim.new(0.1, 0), + PaddingBottom = UDim.new(0.1, 0), + }), + + UIListLayout = e("UIListLayout", { + Padding = UDim.new(0, 20), + SortOrder = Enum.SortOrder.LayoutOrder, + HorizontalAlignment = Enum.HorizontalAlignment.Left, + VerticalAlignment = Enum.VerticalAlignment.Center, + FillDirection = Enum.FillDirection.Horizontal, + }), + + Icon = e("ImageLabel", { + BackgroundTransparency = 0, + Size = UDim2.fromScale(0, 1), + Image = props.Icon, + BackgroundColor3 = Color3.fromRGB(60, 60, 60), + LayoutOrder = 1, + }, { + UIAspectRatioConstraint = e("UIAspectRatioConstraint", { + DominantAxis = Enum.DominantAxis.Height, + AspectType = Enum.AspectType.ScaleWithParentSize, + AspectRatio = 1, + }), + + UICorner = e("UICorner", { + CornerRadius = UDim.new(0, 4), + }), + }), + + Title = e("TextLabel", { + Text = props.Title, + Font = Enum.Font.SourceSansBold, + TextScaled = true, + BackgroundTransparency = 1, + TextColor3 = Color3.fromRGB(255, 255, 255), + TextXAlignment = Enum.TextXAlignment.Left, + Size = UDim2.fromScale(0.4, 1), + Position = UDim2.fromScale(0.5, 0.5), + AnchorPoint = Vector2.new(0.5, 0.5), + LayoutOrder = 2, + }, { + UISizeConstraint = e("UISizeConstraint", { + MinSize = Vector2.new(0, 0), + MaxSize = Vector2.new(500, 200), + }), + + UIStroke = e("UIStroke", { + Thickness = 1, + Color = Color3.fromRGB(0, 0, 0), + Transparency = 0, + }), + + UITextSizeConstraint = e("UITextSizeConstraint", { + MinTextSize = 0, + MaxTextSize = 20, + }), + }), + + ActionButtonHolder = e("Frame", { + Size = UDim2.fromScale(0, 1), + AutomaticSize = Enum.AutomaticSize.X, + BackgroundTransparency = 1, + LayoutOrder = 3, + }, { + UIListLayout = e("UIListLayout", { + Padding = UDim.new(0, 5), + SortOrder = Enum.SortOrder.LayoutOrder, + HorizontalAlignment = Enum.HorizontalAlignment.Left, + VerticalAlignment = Enum.VerticalAlignment.Center, + FillDirection = Enum.FillDirection.Horizontal, + }), + + ActionButtons = e(React.Fragment, nil, actionButtons), + }), + }) +end + +return AssetListEntry diff --git a/src/Stories/AssetListEntry.story.luau b/src/Stories/AssetListEntry.story.luau new file mode 100644 index 0000000..8278a8d --- /dev/null +++ b/src/Stories/AssetListEntry.story.luau @@ -0,0 +1,64 @@ +local Freeway = script:FindFirstAncestor("Freeway") + +local React = require(Freeway.Packages.React) +local ReactRoblox = require(Freeway.Packages.ReactRoblox) + +local e = React.createElement +local AssetListEntry = require(Freeway.Components.AssetListEntry) + +local function OnClick() + print("Clicked") +end + +return function(target) + local root = ReactRoblox.createRoot(Instance.new("Folder")) + root:render(ReactRoblox.createPortal( + e("Frame", { + Position = UDim2.fromScale(0.5, 0.5), + AnchorPoint = Vector2.new(0.5, 0.5), + Size = UDim2.fromScale(0.6, 0.85), + BackgroundTransparency = 1, + }, { + UIListLayout = e("UIListLayout", { + Padding = UDim.new(0, 10), + HorizontalAlignment = Enum.HorizontalAlignment.Center, + VerticalAlignment = Enum.VerticalAlignment.Center, + SortOrder = Enum.SortOrder.Name, + }), + + TextureEntry = e(AssetListEntry, { + Icon = "rbxassetid://138180362075438", + Title = "Texture_1.png", + Actions = { + { Title = "⚡️ Rewire", ButtonStyle = "MainButton", OnActivated = OnClick }, + { Title = "Delete", OnActivated = OnClick }, + }, + }), + + TextureEntry2 = e(AssetListEntry, { + Icon = "rbxassetid://12376249776", + Title = "Mesh_1", + Actions = { + { Title = "⚡️ Rewire", ButtonStyle = "MainButton", OnActivated = OnClick }, + { Title = "Delete", OnActivated = OnClick }, + }, + }), + + ActionExample = e(AssetListEntry, { + Icon = "rbxassetid://12769106192", + Title = "ActionExample", + Actions = { + { Title = "Actions", ButtonStyle = "MainButton", OnActivated = OnClick }, + { Title = "Are", OnActivated = OnClick }, + { Title = "Very", OnActivated = OnClick }, + { Title = "Customizable", OnActivated = OnClick, ButtonStyle = "MainButton" }, + }, + }), + }), + target + )) + + return function() + root:unmount() + end +end