Skip to content

記事のソートをタイトル順にする #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: canary
Choose a base branch
from

Conversation

kiitosu
Copy link

@kiitosu kiitosu commented May 11, 2025

📑 Summary

articleの表示順をタイトル順でソートするようにしました。
以下に作業内容を整理しました。

Resolves #

📋 Tasks

プルリクエストを作成いただく際、お手数ですが以下の内容についてご確認をお願いします。

  • 📖 Contribution Guide を読んだ
  • 👩‍💻 canary ブランチに対するプルリクエストである
  • 実行して正しく動作しているか確認する
  • 不要なコードが含まれていないか( コメントやログの消し忘れに注意 )
  • XSS になるようなコードが含まれていないか
  • Pull Reuqest の内容は妥当か( 膨らみすぎてないか )

より詳しい内容は Pull Request Policy を参照してください。

@cm-igarashi-ryosuke
Copy link
Member

@kiitosu ご提案ありがとうございます!また、ご連絡が遅くなりすみません。順次確認しますのでお待ち下さい 🙏

@cm-wada-yusuke
Copy link
Member

cm-wada-yusuke commented Jun 9, 2025

@kiitosu 実装ありがとうございます!タイトルで並び替えられるのはわかりやすくていいですね。
従来のパス順前提でファイル名を組んでいるパターン(2025-02-02-articleとか)もあるため、デフォルトを変えるとびっくりする人もいるかもしれません。何でソートするか選べるようにすることは可能ですか?こちらでディスカッションできればと思います。

#124

@kiitosu
Copy link
Author

kiitosu commented Jun 10, 2025

@cm-igarashi-ryosuke
以下で設定を追加しました!

title-sort

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the article sorting behavior to allow sorting by title instead of the default file path order.

  • Introduces a new configuration (zenn-preview.sortArticle) that enables title-based sorting.
  • Modifies the PreviewTreeItem.sortTreeItems method to remove emojis from labels before sorting.
  • Updates package.json to define the new configuration option with enum values.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/treeview/previewTreeItem.ts Updated sorting logic to support title-based sorting.
package.json Added configuration definition for sortArticle option.

const aCleanLabel = getCleanLabel(a);
const bCleanLabel = getCleanLabel(b);

if (aCleanLabel || bCleanLabel) {
Copy link
Preview

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using an explicit non-empty string check (e.g., aCleanLabel !== '' || bCleanLabel !== '') to clarify the intended condition and improve code readability for future maintainers.

Suggested change
if (aCleanLabel || bCleanLabel) {
if (aCleanLabel !== '' || bCleanLabel !== '') {

Copilot uses AI. Check for mistakes.

@cm-igarashi-ryosuke
Copy link
Member

@kiitosu ご対応いただきありがとうございます!

内容自体は良さそうですが、package.json のインデントが2から4に変わっているため差分が分かりにくくなっています。お手数ですがインデント2に修正をお願いいたします 🙇

@cm-igarashi-ryosuke cm-igarashi-ryosuke self-requested a review June 16, 2025 02:28
@kiitosu
Copy link
Author

kiitosu commented Jun 16, 2025

@cm-igarashi-ryosuke

すみません気づいてませんでした!
修正しました 👍

@cm-wada-yusuke
Copy link
Member

@kiitosu 忘れていないです、すいません、もう少々お待ち下さい🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants