mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-03 10:14:52 +00:00
code: tsx,icons,fakemui (13 files)
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import { Icon, type IconProps } from './Icon'
|
||||
|
||||
export const Close = (props: IconProps) => (
|
||||
<Icon {...props}>
|
||||
<path d="M205.65686 194.34314a8.00035 8.00035 0 0 1-11.31372 11.31372L128 139.31371l-66.34314 66.34315a8.00035 8.00035 0 0 1-11.31372-11.31372L116.68629 128l-66.34315-66.34314a8.00035 8.00035 0 0 1 11.31372-11.31372L128 116.68629l66.34314-66.34315a8.00035 8.00035 0 0 1 11.31372 11.31372L139.31371 128Z" />
|
||||
</Icon>
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Icon, type IconProps } from './Icon'
|
||||
|
||||
export const ErrorOutline = (props: IconProps) => (
|
||||
<Icon {...props}>
|
||||
<path d="M128 24a104 104 0 1 0 104 104A104.11791 104.11791 0 0 0 128 24Zm0 192a88 88 0 1 1 88-88 88.09957 88.09957 0 0 1-88 88Zm-8-80V80a8 8 0 0 1 16 0v56a8 8 0 0 1-16 0Zm20 36a12 12 0 1 1-12-12 12 12 0 0 1 12 12Z" />
|
||||
</Icon>
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Icon, type IconProps } from './Icon'
|
||||
|
||||
export const ExpandLess = (props: IconProps) => (
|
||||
<Icon {...props}>
|
||||
<path d="M213.65686 165.65686a8.00035 8.00035 0 0 1-11.31372 0L128 91.31371l-74.34314 74.34315a8.00035 8.00035 0 0 1-11.31372-11.31372l80-80a8.00035 8.00035 0 0 1 11.31372 0l80 80a8.00035 8.00035 0 0 1 0 11.31372Z" />
|
||||
</Icon>
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Icon, type IconProps } from './Icon'
|
||||
|
||||
export const ExpandMore = (props: IconProps) => (
|
||||
<Icon {...props}>
|
||||
<path d="M128 184.00003a8.00039 8.00039 0 0 1-5.65686-2.34314l-80-80a8.00035 8.00035 0 0 1 11.31372-11.31372L128 164.68629l74.34314-74.34312a8.00035 8.00035 0 0 1 11.31372 11.31372l-80 80A8.00039 8.00039 0 0 1 128 184.00003Z" />
|
||||
</Icon>
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Icon, type IconProps } from './Icon'
|
||||
|
||||
export const InfoOutlined = (props: IconProps) => (
|
||||
<Icon {...props}>
|
||||
<path d="M128 24a104 104 0 1 0 104 104A104.11791 104.11791 0 0 0 128 24Zm0 192a88 88 0 1 1 88-88 88.09957 88.09957 0 0 1-88 88Zm-8-112a8 8 0 0 1 8-8 16 16 0 0 0 0-32 16.00006 16.00006 0 0 0-16 16 8 8 0 0 1-16 0 32 32 0 1 1 32 32 8 8 0 0 1-8-8Zm8 60v-16a8 8 0 0 1 16 0v16a8 8 0 0 1-16 0Z" />
|
||||
</Icon>
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Icon, type IconProps } from './Icon'
|
||||
|
||||
export const Visibility = (props: IconProps) => (
|
||||
<Icon {...props}>
|
||||
<path d="M247.31152 124.76172c-.35156-.79-8.81934-19.57519-27.65527-38.41064C194.57324 61.26758 162.877 48 128 48S61.42676 61.26758 36.34375 86.35108c-18.836 18.83545-27.30371 37.62064-27.65527 38.41064a8.00282 8.00282 0 0 0 0 6.47656c.35156.79 8.81934 19.57519 27.65527 38.41113C61.42676 194.73242 93.123 208 128 208s66.57324-13.26758 91.65625-38.35059c18.83593-18.83594 27.30371-37.62113 27.65527-38.41113a8.00282 8.00282 0 0 0 0-6.47656ZM128 192c-30.78613 0-57.67188-11.19922-79.89453-33.29443A130.33 130.33 0 0 1 25.90723 128a130.332 130.332 0 0 1 22.19824-30.70557C70.32812 75.19922 97.21387 64 128 64s57.67188 11.19922 79.89453 33.29443A130.33 130.33 0 0 1 230.09277 128C218.46875 152.11328 179.89355 192 128 192Zm0-112a48 48 0 1 0 48 48 48.05436 48.05436 0 0 0-48-48Zm0 80a32 32 0 1 1 32-32 32.03635 32.03635 0 0 1-32 32Z" />
|
||||
</Icon>
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Icon, type IconProps } from './Icon'
|
||||
|
||||
export const VisibilityOff = (props: IconProps) => (
|
||||
<Icon {...props}>
|
||||
<path d="M53.91992 34.61914a8.0004 8.0004 0 0 0-11.83984 10.76172l19.25586 21.1875C36.3584 81.78613 21.90234 103.04785 17.38477 111.95117a16.15584 16.15584 0 0 0 0 14.13281c15.60547 31.54785 49.44238 70.47461 95.98535 73.62305.624.0371 1.24609.0664 1.86914.09375l35.08594 38.58984a8.0004 8.0004 0 1 0 11.83984-10.76172l-24.55664-27.01269c2.03516-.05762 4.06153-.15625 6.0752-.30762 46.54297-3.14844 80.37988-42.0752 95.98535-73.62305a16.15584 16.15584 0 0 0 0-14.13281c-4.51758-8.90332-18.97363-30.165-43.94531-45.35058ZM128 176c-29.50391 0-55.70215-11.47949-77.79492-34.10742A126.30518 126.30518 0 0 1 33.21973 119a126.308 126.308 0 0 1 16.98535-22.89258L91.708 143.916A40.00268 40.00268 0 0 0 128 160a39.28528 39.28528 0 0 0 11.48242-1.78516l26.5752 29.22949A99.4447 99.4447 0 0 1 128 176Zm75.79492-11.89258a141.54141 141.54141 0 0 1-17.626 16.75293l-67.08007-73.78906A39.97945 39.97945 0 0 0 168 128a39.28528 39.28528 0 0 0 1.78516-11.48242l29.22949-26.5752c6.999 5.72266 13.40137 11.97949 19.20508 18.165A126.30814 126.30814 0 0 1 235.20508 131 126.308 126.308 0 0 1 203.79492 164.10742Z" />
|
||||
</Icon>
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Icon, type IconProps } from './Icon'
|
||||
|
||||
export const WarningAmber = (props: IconProps) => (
|
||||
<Icon {...props}>
|
||||
<path d="M236.79688 187.90381l-89.01368-151.89209a20.00076 20.00076 0 0 0-35.56836 0L23.20312 187.90381a20.00006 20.00006 0 0 0 17.78516 28.80713h178.02344a20.00006 20.00006 0 0 0 17.78516-28.80713ZM120 104a8 8 0 0 1 16 0v40a8 8 0 0 1-16 0Zm8 88a12 12 0 1 1 12-12 12 12 0 0 1-12 12Z" />
|
||||
</Icon>
|
||||
)
|
||||
@@ -1,54 +1,3 @@
|
||||
local validate = require("validate")
|
||||
|
||||
---@class LoginActions
|
||||
local M = {}
|
||||
|
||||
---@class LoginForm
|
||||
---@field username string
|
||||
---@field password string
|
||||
|
||||
---@class RegisterForm
|
||||
---@field username string
|
||||
---@field email string
|
||||
---@field password string
|
||||
|
||||
---@class ValidationError
|
||||
---@field field string
|
||||
---@field message string
|
||||
|
||||
---@class LoginSuccess
|
||||
---@field success true
|
||||
---@field action "login"
|
||||
---@field username string
|
||||
|
||||
---@class RegisterSuccess
|
||||
---@field success true
|
||||
---@field action "register"
|
||||
---@field username string
|
||||
---@field email string
|
||||
|
||||
---@class ActionFailure
|
||||
---@field success false
|
||||
---@field errors ValidationError[]
|
||||
|
||||
---@param form LoginForm
|
||||
---@return LoginSuccess|ActionFailure
|
||||
function M.handleLogin(form)
|
||||
local result = validate.login(form)
|
||||
if not result.valid then
|
||||
return { success = false, errors = result.errors }
|
||||
end
|
||||
return { success = true, action = "login", username = form.username }
|
||||
end
|
||||
|
||||
---@param form RegisterForm
|
||||
---@return RegisterSuccess|ActionFailure
|
||||
function M.handleRegister(form)
|
||||
local result = validate.register(form)
|
||||
if not result.valid then
|
||||
return { success = false, errors = result.errors }
|
||||
end
|
||||
return { success = true, action = "register", username = form.username, email = form.email }
|
||||
end
|
||||
|
||||
return M
|
||||
-- Actions module redirect
|
||||
-- Functions split into actions/ directory for 1-function-per-file pattern
|
||||
return require("actions.init")
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
-- Handle login form submission
|
||||
|
||||
local validate = require("validate")
|
||||
|
||||
---@class LoginForm
|
||||
---@field username string
|
||||
---@field password string
|
||||
|
||||
---@class ValidationError
|
||||
---@field field string
|
||||
---@field message string
|
||||
|
||||
---@class LoginSuccess
|
||||
---@field success true
|
||||
---@field action "login"
|
||||
---@field username string
|
||||
|
||||
---@class ActionFailure
|
||||
---@field success false
|
||||
---@field errors ValidationError[]
|
||||
|
||||
local M = {}
|
||||
|
||||
---Process login form and validate credentials
|
||||
---@param form LoginForm
|
||||
---@return LoginSuccess|ActionFailure
|
||||
function M.handleLogin(form)
|
||||
local result = validate.login(form)
|
||||
if not result.valid then
|
||||
return { success = false, errors = result.errors }
|
||||
end
|
||||
return {
|
||||
success = true,
|
||||
action = "login",
|
||||
username = form.username
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,42 @@
|
||||
-- Handle registration form submission
|
||||
|
||||
local validate = require("validate")
|
||||
|
||||
---@class RegisterForm
|
||||
---@field username string
|
||||
---@field email string
|
||||
---@field password string
|
||||
|
||||
---@class ValidationError
|
||||
---@field field string
|
||||
---@field message string
|
||||
|
||||
---@class RegisterSuccess
|
||||
---@field success true
|
||||
---@field action "register"
|
||||
---@field username string
|
||||
---@field email string
|
||||
|
||||
---@class ActionFailure
|
||||
---@field success false
|
||||
---@field errors ValidationError[]
|
||||
|
||||
local M = {}
|
||||
|
||||
---Process registration form and validate data
|
||||
---@param form RegisterForm
|
||||
---@return RegisterSuccess|ActionFailure
|
||||
function M.handleRegister(form)
|
||||
local result = validate.register(form)
|
||||
if not result.valid then
|
||||
return { success = false, errors = result.errors }
|
||||
end
|
||||
return {
|
||||
success = true,
|
||||
action = "register",
|
||||
username = form.username,
|
||||
email = form.email
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,15 @@
|
||||
-- Actions module facade
|
||||
-- Re-exports all action handlers for backward compatibility
|
||||
|
||||
local login = require("actions.handle_login")
|
||||
local register = require("actions.handle_register")
|
||||
|
||||
---@class ActionsModule
|
||||
---@field handleLogin fun(form: LoginForm): LoginSuccess|ActionFailure
|
||||
---@field handleRegister fun(form: RegisterForm): RegisterSuccess|ActionFailure
|
||||
local M = {}
|
||||
|
||||
M.handleLogin = login.handleLogin
|
||||
M.handleRegister = register.handleRegister
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,31 @@
|
||||
-- Type definitions for login actions module
|
||||
|
||||
---@class LoginForm
|
||||
---@field username string User's username
|
||||
---@field password string User's password
|
||||
|
||||
---@class RegisterForm
|
||||
---@field username string User's username
|
||||
---@field email string User's email address
|
||||
---@field password string User's password
|
||||
|
||||
---@class ValidationError
|
||||
---@field field string Field name with error
|
||||
---@field message string Error message
|
||||
|
||||
---@class LoginSuccess
|
||||
---@field success true Indicates success
|
||||
---@field action "login" Action type
|
||||
---@field username string Authenticated username
|
||||
|
||||
---@class RegisterSuccess
|
||||
---@field success true Indicates success
|
||||
---@field action "register" Action type
|
||||
---@field username string Registered username
|
||||
---@field email string Registered email
|
||||
|
||||
---@class ActionFailure
|
||||
---@field success false Indicates failure
|
||||
---@field errors ValidationError[] List of validation errors
|
||||
|
||||
return {}
|
||||
Reference in New Issue
Block a user