Skip to content

Simplify topic layout rendering#273

Open
onurmatik wants to merge 3 commits into
refactoringfrom
codex/refactor-topic-layout-and-edit-template-wmbxa2
Open

Simplify topic layout rendering#273
onurmatik wants to merge 3 commits into
refactoringfrom
codex/refactor-topic-layout-and-edit-template-wmbxa2

Conversation

@onurmatik
Copy link
Copy Markdown
Owner

Summary

  • partition topic layout modules into fixed, reorderable, and additional buckets so fixed cards render in their static positions
  • update the edit and detail templates to render cover, recap, timeline, entities, and related topics outside of the reorderable stack
  • restrict serialized layout data to reorderable modules and define explicit display orders for fixed sections

Testing

  • python -m compileall semanticnews/topics

https://chatgpt.com/codex/tasks/task_b_68fcd20c41f083289956b27890202dfa

@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

function collectLayout() {
const payload = [];
getReorderableModules().forEach((moduleEl, index) => {
moduleEl.dataset.displayOrder = String(index);
payload.push({
module_key: moduleEl.dataset.module || '',
placement: moduleEl.dataset.placement || 'primary',
display_order: index,
});
});

P1 Badge Preserve sidebar reorderable modules when saving layout

The client now builds the payload for PUT /layout by iterating only elements inside [data-layout-list] (collectLayout() in topics/static/topics/layout.js). Modules rendered in the sidebar are excluded from that list even if they are reorderable (e.g. existing text or data cards that a user previously moved to the sidebar). When a save occurs, update_topic_layout_configuration() deletes all TopicModuleLayout rows before recreating the ones present in the payload, so those sidebar modules are dropped from the database and disappear from the topic (there is no default layout entry for text modules, so they vanish entirely). Any edit of the primary stack will therefore erase sidebar text/data modules. The payload needs to include all existing reorderable modules or the API must avoid deleting untouched entries.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@onurmatik onurmatik force-pushed the refactoring branch 2 times, most recently from 8683a53 to f47004d Compare October 26, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant