:: AchievementsOverview
<<set _achievementsInMemory = recall("achievements",{})>>
<<for _achievementId, _achievement range window.achievements>>

    <<set _display to "default">>
    <<if !(_achievementId in _achievementsInMemory) or _achievementsInMemory[_achievementId].completion < 1 >>
        <<if _achievement.obscured === true>>
            <<set _display to "obscured">>
        <<elseif _achievement.hidden === true>>
            <<set _display to "none">>
        <</if>>
    <</if>>

    <<if _display != "none">>

        <div class="achievement">

            <<if _display == "default">>
                <p class="label">_achievement.label</p>
                <<if "caption" in _achievement>>
                    <p class="caption">
                        _achievement.caption
                    </p>
                <</if>>
            <<elseif _display == "obscured">>
                <p class="label">???</p>
            <</if>>
            <<if _achievementId in _achievementsInMemory>>
                <<set _aim to _achievementsInMemory[_achievementId]>>
                <p class="time">
                    <<print new Date(_aim.time).toUTCString()>>
                </p>
            <</if>>
        </div>

    <</if>>
<</for>>

<div>
    <<linkreplace  "Reset">>
        Are you sure? This will delete all your achievement data. This can't be undone!
        <<link [[Confirm|AchievementsOverview]]>>
            <<run memorize("achievements",{})>>
        <</link>>
    <</linkreplace >>
</div>

<<debug>>
    <<print JSON.stringify(_achievementsInMemory)>>
<</debug>>
