local AceGUI = LibStub("AceGUI-3.0")

-- Ensure SharedMedia is loaded
local LSM = LibStub("LibSharedMedia-3.0")

-- Function to show the change log
Critmatic.showChangeLog = function()
    -- Create a container frame
    local frame = AceGUI:Create("Frame")
    frame:SetTitle("CritMatic - Change Log")
    frame:SetStatusText("Need Help? Copy the Discord Link in General Options. ")
    frame:SetLayout("Fill")
    frame:SetWidth(600)
    frame:SetHeight(500)

    local backgroundTexture = LSM:Fetch("background", Critmatic.db.profile.changeLogPopUp.borderAndBackgroundSettings.backgroundTexture)
    frame.frame:SetBackdrop({
        bgFile = backgroundTexture,
        edgeFile = LSM:Fetch("border", Critmatic.db.profile.changeLogPopUp.borderAndBackgroundSettings.borderTexture),
        edgeSize = Critmatic.db.profile.changeLogPopUp.borderAndBackgroundSettings.borderSize,
    })

    -- Create a scroll container
    local scrollContainer = AceGUI:Create("SimpleGroup")
    scrollContainer:SetFullWidth(true)
    scrollContainer:SetFullHeight(true)
    scrollContainer:SetLayout("Fill")
    frame:AddChild(scrollContainer)

    -- Create a ScrollFrame
    local scroll = AceGUI:Create("ScrollFrame")
    scroll:SetLayout("List")
    scrollContainer:AddChild(scroll)

    -- Add the change log text
    local changelog = [[

[v6.3.2-release] - 05/18/2026

 Fixed:

 Crit Log header icon now renders the new crossed-swords medallion. v6.3.1 shipped the new art but the WoW client kept showing the cached old icon.blp render for that frame on existing installs. Renamed the texture to critmatic-medallion.tga (a path WoW has no cached entry for) and pointed the TOC IconTexture and CritLog header SetTexture at it. Texture also re-rendered from the source PNG without the redundant circular mask, so the sword hilts and full blade bodies are preserved.


[v6.3.1-release] - 05/18/2026

 Changed:

 Addon icon refreshed. New round, alpha-masked crossed-swords medallion replaces the old icon.blp. Ships as a 256x256 TGA, cropped tight on the swords with the outer glow trimmed back so the blades stay legible in the Crit Log header and the AddOns-list thumbnail. Pure art swap, no behavior changes.


[v6.3.0-release] - 05/17/2026

 Added:

 GearMatic and RepMatic addon links added to the About / By section of General Options, directly under the Follow on X row. Each row is a 24x24 icon plus a full-width copyable input field pre-filled with the CurseForge URL. Click the field, Ctrl+A / Cmd+A, copy, paste into a browser. Localized across all eleven supported locales.


For the full version history see CHANGE_LOG.md on GitHub or CurseForge.

]]

    local r, g, b = unpack(Critmatic.db.profile.changeLogPopUp.fontSettings.fontColor)
    -- Fetch the custom font from SharedMedia
    local customFont = LSM:Fetch("font", Critmatic.db.profile.changeLogPopUp.fontSettings.font)
    local logLabel = AceGUI:Create("Label")
    logLabel:SetText(changelog)
    logLabel:SetFullWidth(true)

    logLabel:SetFont(customFont, Critmatic.db.profile.changeLogPopUp.fontSettings.fontSize, Critmatic.db.profile.changeLogPopUp.fontSettings.fontOutline)
    logLabel:SetColor(r, g, b)

    scroll:AddChild(logLabel)

end

