add: more commits
Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
// Static mirror of the backend ACHIEVEMENT_REGISTRY.
|
||||
// Keep in sync with new_starr/data/achievements.data.js.
|
||||
|
||||
export const ACHIEVEMENT_REGISTRY = [
|
||||
{ key: "early_access", type: "badge", label: "Early Access", description: "Registered during the Philproperties beta period." },
|
||||
{ key: "premium_first_time", type: "badge", label: "Premium Member", description: "Purchased a Premium tier plan for the first time." },
|
||||
{ key: "exclusive_first_time", type: "badge", label: "Exclusive Member", description: "Purchased an Exclusive tier plan for the first time." },
|
||||
{ key: "first_course_completed", type: "milestone", label: "First Course Completed", description: "Completed your very first course on Philproperties." },
|
||||
{ key: "courses_completed_5", type: "milestone", label: "Learning Streak", description: "Completed 5 courses." },
|
||||
{ key: "courses_completed_10", type: "milestone", label: "Knowledge Builder", description: "Completed 10 courses." },
|
||||
{ key: "perfect_quiz_score", type: "milestone", label: "Perfect Score", description: "Achieved a perfect score on a quiz." },
|
||||
{ key: "profile_completed", type: "milestone", label: "Profile Complete", description: "Filled out all personal profile information." },
|
||||
{ key: "first_referral", type: "milestone", label: "Referral Champion", description: "Successfully referred a user to Philproperties." },
|
||||
];
|
||||
@@ -0,0 +1,11 @@
|
||||
import React from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
|
||||
// Same renderer used for the live Preview tab (via <ReactMarkdown>), so the
|
||||
// stored html_body always matches what the admin saw in preview.
|
||||
export function markdownToHtml(markdown) {
|
||||
const trimmed = (markdown ?? "").trim();
|
||||
if (!trimmed) return "";
|
||||
return renderToStaticMarkup(React.createElement(ReactMarkdown, null, trimmed));
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// utils/media.util.js
|
||||
//
|
||||
// Resolves a displayable <img> src for an asset payload that may carry a
|
||||
// short-lived stream_token (private/S3 — proxied through the backend) instead
|
||||
// of a raw file_url. Private assets must never expose their real storage URL
|
||||
// to the browser — see controllers/admin/assets.controller.js's redactS3Url
|
||||
// pattern, mirrored for advertisements in controllers/*/advertisements.controller.js.
|
||||
|
||||
const API_BASE = (import.meta.env.VITE_API_URL ?? "http://localhost:3024").replace(/\/$/, "");
|
||||
|
||||
export function streamUrl(token) {
|
||||
return token ? `${API_BASE}/client/media/stream/${token}` : null;
|
||||
}
|
||||
|
||||
// asset: { stream_token?, file_url?, thumbnail_url? } — stream_token always
|
||||
// wins when present (proxied); file_url/thumbnail_url are only ever populated
|
||||
// here for public/chibisafe assets, which don't need proxying.
|
||||
export function resolveAssetSrc(asset) {
|
||||
if (!asset) return null;
|
||||
if (asset.stream_token) return streamUrl(asset.stream_token);
|
||||
return asset.thumbnail_url || asset.file_url || null;
|
||||
}
|
||||
Reference in New Issue
Block a user