Skip to content

Commit

Permalink
Merge pull request #27 from alpaca-tc/fixed-25
Browse files Browse the repository at this point in the history
Render the number of sources
  • Loading branch information
alpaca-tc authored May 9, 2024
2 parents fbab5e0 + 1d00548 commit 2ba2468
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/models/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export type Definition = {
id: number
definitionGroup: string | null
title: string
sourcesCount: number
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const List = forwardRef<HTMLLIElement, Props>((props, ref) => {

items.push({
key: `definition-${definition.id}`,
title: definition.title,
title: `(${definition.sourcesCount}) ${definition.title}`,
isSelected,
onClick: onClickDefinition,
prefix: (
Expand Down
2 changes: 2 additions & 0 deletions frontend/repositories/definitionListRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type DefinitionReponse = {
id: number
definition_group: string | null
title: string
sources_count: number
}

type DefinitionsResponse = {
Expand Down Expand Up @@ -47,6 +48,7 @@ export const useDefinitionList = (
id: definition.id,
definitionGroup: definition.definition_group,
title: definition.title,
sourcesCount: definition.sources_count,
}))
}, [])

Expand Down
1 change: 1 addition & 0 deletions lib/diver_down/web/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def definitions(page:, per:, title:, source:, definition_group:)
id: definition.store_id,
definition_group: definition.definition_group,
title: definition.title,
sources_count: definition.sources.size,
}
end,
pagination: pagination.to_h
Expand Down
1 change: 1 addition & 0 deletions spec/diver_down/web_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def app
'id' => 1,
'title' => 'title',
'definition_group' => nil,
'sources_count' => 1,
},
],
'pagination' => {
Expand Down

0 comments on commit 2ba2468

Please sign in to comment.