Skip to content

Commit

Permalink
fix: render the uid for all messages in a channel (#175)
Browse files Browse the repository at this point in the history
Co-authored-by: Maciej Urbańczyk <[email protected]>
  • Loading branch information
stuartforrest-infinity and magicmatatjahu authored Oct 6, 2021
1 parent 5442fce commit a155954
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions components/Channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,25 @@ function Parameters({ parameters }) {
);
}

function OperationMessages({ messages }) {
return (
<>
{messages.length > 1 &&
<Text newLines={2}>
Accepts **one of** the following messages:
</Text>
}
{messages.map(msg => (
<Message title={`Message \`${msg.uid()}\``} message={msg} />
))
}
</>
)
}

function Operation({ operation }) {
const type = operation.isPublish() ? 'publish' : 'subscribe';
const hasMessages = operation.hasMultipleMessages() || !!operation.message(0);
return (
<Text>
<Header type={4}>{`\`${type}\` Operation`}</Header>
Expand All @@ -71,17 +88,8 @@ function Operation({ operation }) {
{operation.description()}
</Text>
)}
{operation.hasMultipleMessages() ? (
<>
<Text newLines={2}>
Accepts **one of** the following messages:
</Text>
{operation.messages().map(msg => (
<Message title={`Message \`${msg.uid()}\``} message={msg} />
))}
</>
) : (
<Message title='Message' message={operation.message(0)} />
{hasMessages && (
<OperationMessages messages={operation.messages()} />
)}
</Text>
);
Expand Down

0 comments on commit a155954

Please sign in to comment.