Files
metabuilder/packages/quick_guide/seed/scripts/handle_video_change.lua
T
git 9d27207fbc Refactor package validation and quick guide modules
- Simplified structure validation by re-exporting functions from structure_config and validate_structure modules for better maintainability.
- Consolidated validation logic in validate.lua, delegating to validate_package module for clearer orchestration.
- Introduced new quick guide functionalities including step management (add, remove, update, reset ordering) and media handling (thumbnail and video URL validation).
- Added utility functions for URL validation and step creation, enhancing the quick guide's usability.
- Established type definitions for steps and media states to improve code clarity and type safety.
- Enhanced schema editor with new field and relation definitions, providing a more robust structure for database schema management.
2025-12-30 11:17:40 +00:00

20 lines
562 B
Lua

local is_valid_url = require("is_valid_url")
local is_video_url = require("is_video_url")
--- Handle video URL change
---@param state MediaState Current state
---@param newUrl string New video URL
---@return MediaState Updated state
local function handle_video_change(state, newUrl)
return {
thumbnailUrl = state.thumbnailUrl,
videoUrl = newUrl,
thumbnailValid = state.thumbnailValid,
videoValid = is_valid_url(newUrl),
thumbnailIsImage = state.thumbnailIsImage,
videoIsVideo = is_video_url(newUrl)
}
end
return handle_video_change