Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into readme-badges
Browse files Browse the repository at this point in the history
  • Loading branch information
vocksel committed Nov 10, 2024
2 parents 703f5e3 + e85d110 commit f49bb9a
Show file tree
Hide file tree
Showing 46 changed files with 695 additions and 900 deletions.
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@
"@pkg": "./Packages",
"@root": "./src",
"@lune/": "~/.lune/.typedefs/0.8.3/"
},
"files.associations": {
"*.luau": "lua"
}
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2021 David Minnerly
Copyright 2021 flipbook-labs

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ You can install flipbook from the [Roblox marketplace](https://www.roblox.com/li

## Documentation

Learn how to use flipbook on the [documentation site](https://flipbook-labs.github.io/flipbook/).
Learn how to use flipbook on the [official documentation site](https://flipbook-labs.github.io/flipbook/).

## Contributing

Before opening a pull request, check out our [contributing guide](https://flipbook-labs.github.io/flipbook/docs/contributing/) to learn how we develop the plugin.

## License

[MIT License](LICENSE)
flipbook is licensed under [MIT License](LICENSE).
5 changes: 4 additions & 1 deletion build.project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"Example": {
"$path": "example"
},
"wally.toml": {
"$path": "wally.toml"
},
"$path": "src"
}
}
}
5 changes: 4 additions & 1 deletion default.project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"Packages": {
"$path": "Packages"
},
"wally.toml": {
"$path": "wally.toml"
},
"$path": "build"
}
}
}
2 changes: 1 addition & 1 deletion foreman.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ selene = { source = "Kampfkarren/selene", version = "0.27.1" }
stylua = { source = "JohnnyMorganz/StyLua", version = "0.20.0" }
tarmac = { source = "Roblox/tarmac", version = "0.7.0" }
wally = { source = "UpliftGames/wally", version = "0.3.2" }
luau-lsp = { source = "JohnnyMorganz/luau-lsp", version = "1.32.3" }
luau-lsp = { source = "JohnnyMorganz/luau-lsp", version = "1.34.0" }
wally-package-types = { source = "JohnnyMorganz/wally-package-types", version = "1.3.2" }
Binary file added img/GitHubMark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
147 changes: 147 additions & 0 deletions src/About/AboutView.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
local React = require("@pkg/React")

local RobloxProfile = require("@root/About/RobloxProfile")
local Sprite = require("@root/Common/Sprite")
local assets = require("@root/assets")
local nextLayoutOrder = require("@root/Common/nextLayoutOrder")
local useTheme = require("@root/Common/useTheme")
local wally = require(script.Parent.Parent["wally.toml"])

local useMemo = React.useMemo

local AUTHOR_USER_IDS = {
1343930,
731053179,
}

local function AboutView()
local theme = useTheme()
local currentYear = useMemo(function()
return (DateTime.now():ToUniversalTime() :: any).Year
end, {})

local authors: { [string]: React.Node } = {}
for _, userId in AUTHOR_USER_IDS do
authors[`Author{userId}`] = React.createElement(RobloxProfile, {
userId = userId,
LayoutOrder = nextLayoutOrder(),
})
end

return React.createElement("Frame", {
Size = UDim2.fromScale(1, 1),
BackgroundColor3 = theme.background,
BorderSizePixel = 0,
}, {
Layout = React.createElement("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
HorizontalAlignment = Enum.HorizontalAlignment.Center,
Padding = theme.paddingLarge,
}),

Padding = React.createElement("UIPadding", {
PaddingTop = theme.paddingLarge,
PaddingRight = theme.paddingLarge,
PaddingBottom = theme.paddingLarge,
PaddingLeft = theme.paddingLarge,
}),

Logo = React.createElement(Sprite, {
layoutOrder = nextLayoutOrder(),
image = assets.IconLight,
size = UDim2.fromOffset(42, 42),
}),

Title = React.createElement("TextLabel", {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
Font = theme.font,
LayoutOrder = nextLayoutOrder(),
Size = UDim2.fromScale(0, 0),
Text = `flipbook v{wally.package.version}`,
TextColor3 = theme.text,
TextSize = theme.headerTextSize,
TextWrapped = true,
}),

GitHub = React.createElement("Frame", {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
LayoutOrder = nextLayoutOrder(),
}, {
Layout = React.createElement("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
FillDirection = Enum.FillDirection.Horizontal,
Padding = theme.paddingSmall,
}),

Icon = React.createElement(Sprite, {
layoutOrder = nextLayoutOrder(),
color = theme.github,
image = assets.GitHubMark,
size = UDim2.fromOffset(theme.textSize, theme.textSize),
}),

Label = React.createElement("TextLabel", {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
Font = theme.font,
LayoutOrder = nextLayoutOrder(),
Size = UDim2.fromScale(0, 0),
Text = "flipbook-labs/flipbook",
TextColor3 = theme.text,
TextSize = theme.textSize,
}),
}),

Authors = React.createElement("Frame", {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
LayoutOrder = nextLayoutOrder(),
}, {
Layout = React.createElement("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
HorizontalAlignment = Enum.HorizontalAlignment.Center,
Padding = theme.padding,
}),

Title = React.createElement("TextLabel", {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
Font = theme.font,
LayoutOrder = nextLayoutOrder(),
Size = UDim2.fromScale(0, 0),
Text = `Created by:`,
TextColor3 = theme.text,
TextSize = theme.textSize,
TextWrapped = true,
}),

AuthorList = React.createElement("Frame", {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
LayoutOrder = nextLayoutOrder(),
}, {
Layout = React.createElement("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
FillDirection = Enum.FillDirection.Horizontal,
Padding = theme.padding,
}),
}, authors),
}),

Copy = React.createElement("TextLabel", {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
Font = theme.font,
LayoutOrder = nextLayoutOrder(),
Size = UDim2.fromScale(0, 0),
Text = `Copyright © 2021—{currentYear} flipbook-labs`,
TextColor3 = theme.text,
TextSize = theme.textSize,
TextWrapped = true,
}),
})
end

return AboutView
15 changes: 15 additions & 0 deletions src/About/AboutView.story.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
local React = require("@pkg/React")

local AboutView = require("./AboutView")
local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")

return {
story = function()
return React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
AboutView = React.createElement(AboutView),
})
end,
}
79 changes: 79 additions & 0 deletions src/About/RobloxProfile.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
local Players = game:GetService("Players")

local React = require("@pkg/React")
local ReactSpring = require("@pkg/ReactSpring")

local nextLayoutOrder = require("@root/Common/nextLayoutOrder")
local useTheme = require("@root/Common/useTheme")

local useState = React.useState
local useEffect = React.useEffect

local AVATAR_SIZE = Enum.ThumbnailSize.Size48x48

export type Props = {
userId: number,
LayoutOrder: number?,
}

local function RobloxProfile(props: Props)
local theme = useTheme()
local avatar, setAvatar = useState(nil :: string?)
local username, setUsername = useState(nil :: string?)

local isLoading = avatar == nil and username == nil

local styles = ReactSpring.useSpring({
alpha = if isLoading then 1 else 0,
})

useEffect(function()
task.spawn(function()
setAvatar(Players:GetUserThumbnailAsync(props.userId, Enum.ThumbnailType.HeadShot, AVATAR_SIZE))
end)

task.spawn(function()
setUsername(Players:GetNameFromUserIdAsync(props.userId))
end)
end, { props.userId })

return React.createElement("Frame", {
LayoutOrder = props.LayoutOrder,
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
}, {
Layout = React.createElement("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
FillDirection = Enum.FillDirection.Horizontal,
VerticalAlignment = Enum.VerticalAlignment.Center,
Padding = theme.paddingSmall,
}),

Avatar = React.createElement("ImageLabel", {
LayoutOrder = nextLayoutOrder(),
Size = UDim2.fromOffset(48, 48),
BackgroundColor3 = theme.sidebar,
BackgroundTransparency = 0.6,
ImageTransparency = styles.alpha,
BorderSizePixel = 0,
Image = avatar,
}, {
Corner = React.createElement("UICorner", {
CornerRadius = UDim.new(0.5, 0),
}),
}),

Username = React.createElement("TextLabel", {
LayoutOrder = nextLayoutOrder(),
Text = `@{username}`,
Font = theme.font,
TextColor3 = theme.text,
TextSize = theme.textSize,
BackgroundTransparency = 1,
TextTransparency = styles.alpha,
AutomaticSize = Enum.AutomaticSize.XY,
}),
})
end

return RobloxProfile
27 changes: 27 additions & 0 deletions src/About/RobloxProfile.story.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
local React = require("@pkg/React")

local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")
local RobloxProfile = require("./RobloxProfile")

local controls = {
userId = 1,
}

type Props = {
controls: typeof(controls),
}
return {
controls = controls,
story = function(props: Props)
local userId = assert(tonumber(props.controls.userId))

return React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
RobloxProfiler = React.createElement(RobloxProfile, {
userId = userId,
}),
})
end,
}
62 changes: 0 additions & 62 deletions src/Common/useDescendants.luau

This file was deleted.

Loading

0 comments on commit f49bb9a

Please sign in to comment.