generated from ajturner/ajturner-prototype-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
148 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:host { | ||
display: block; | ||
background-color: white; | ||
border-radius: 4px; | ||
padding: 1rem; | ||
border: 1px solid var(--calcite-color-border-1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Component, Host, Prop, h } from '@stencil/core'; | ||
import { HubPostSummary } from '../../util/search'; | ||
|
||
@Component({ | ||
tag: 'hub-posts-summary', | ||
styleUrl: 'hub-posts-summary.css', | ||
shadow: true, | ||
}) | ||
export class HubPostsSummary { | ||
|
||
@Prop() summary: HubPostSummary = {}; | ||
|
||
render() { | ||
return ( | ||
<Host> | ||
<slot></slot> | ||
<div class="summary"> | ||
<h3>Summary</h3> | ||
<p>{this.summary.text}</p> | ||
</div> | ||
</Host> | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
export interface Analysis { | ||
range: [number, number]; | ||
name: string; | ||
icon: string; | ||
selected: boolean; | ||
} | ||
range: [number, number]; | ||
name: string; | ||
icon: string; | ||
selected: boolean; | ||
} | ||
|
||
export const authenticityAnalysis: Analysis[] = [ | ||
{ range: [0.2, Infinity], name: 'Authentic', icon: 'check-circle-f', selected: true }, | ||
{ range: [-0.5, 0.2], name: 'Neutral Authenticity', icon: 'rings', selected: false }, | ||
{ range: [-Infinity, -0.5], name: 'Fake', icon: 'exclamation-mark-triangle-f', selected: false }, | ||
{ range: [-Infinity, Infinity], name: 'Unknown', icon: 'question', selected: false }, | ||
]; | ||
export const authenticityAnalysis: Analysis[] = [ | ||
{ range: [0.2, 1], name: 'Authentic', icon: 'check-circle-f', selected: true }, | ||
{ range: [-0.5, 0.2], name: 'Neutral Authenticity', icon: 'rings', selected: false }, | ||
{ range: [-1, -0.5], name: 'Fake', icon: 'exclamation-mark-triangle-f', selected: false }, | ||
{ range: [-1, 1], name: 'Unknown', icon: 'question', selected: false }, | ||
]; | ||
|
||
export const sentimentAnalysis: Analysis[] = [ | ||
{ range: [0.3, Infinity], name: 'Positive', icon: 'check-circle-f', selected: true }, | ||
{ range: [0, 0.3], name: 'Slightly Positive', icon: 'rings', selected: false }, | ||
{ range: [-0.5, 0], name: 'Slightly Negative', icon: 'rings', selected: false }, | ||
{ range: [-Infinity, -0.5], name: 'Negative', icon: 'exclamation-mark-triangle-f', selected: false }, | ||
{ range: [-Infinity, Infinity], name: 'Unknown', icon: 'question', selected: false }, | ||
]; | ||
export const sentimentAnalysis: Analysis[] = [ | ||
{ range: [0.3, 1], name: 'Positive', icon: 'check-circle-f', selected: true }, | ||
{ range: [0, 0.3], name: 'Slightly Positive', icon: 'rings', selected: false }, | ||
{ range: [-0.5, 0], name: 'Slightly Negative', icon: 'rings', selected: false }, | ||
{ range: [-1, -0.5], name: 'Negative', icon: 'exclamation-mark-triangle-f', selected: false }, | ||
{ range: [-1, 1], name: 'Unknown', icon: 'question', selected: false }, | ||
]; | ||
|
||
export const toxicityAnalysis: Analysis[] = [ | ||
{ range: [0.2, Infinity], name: 'OK', icon: 'check-circle-f', selected: false }, | ||
{ range: [-0.5, 0.2], name: 'Neutral', icon: 'rings', selected: true }, | ||
{ range: [-Infinity, -0.5], name: 'Toxic', icon: 'exclamation-mark-triangle-f', selected: false }, | ||
{ range: [-Infinity, Infinity], name: 'Unknown', icon: 'question', selected: false }, | ||
]; | ||
export const toxicityAnalysis: Analysis[] = [ | ||
{ range: [0.2, 1], name: 'OK', icon: 'check-circle-f', selected: false }, | ||
{ range: [-0.5, 0.2], name: 'Neutral', icon: 'rings', selected: true }, | ||
{ range: [-1, -0.5], name: 'Toxic', icon: 'exclamation-mark-triangle-f', selected: false }, | ||
{ range: [-1, 1], name: 'Unknown', icon: 'question', selected: false }, | ||
]; | ||
|
||
|
||
export function getAnalysisConfiguration(name: string): Analysis[] { | ||
switch (name) { | ||
case 'authenticity': | ||
return authenticityAnalysis; | ||
case 'sentiment': | ||
return sentimentAnalysis; | ||
case 'toxicity': | ||
return toxicityAnalysis; | ||
default: | ||
return []; | ||
} | ||
export function getAnalysisConfiguration(name: string): Analysis[] { | ||
switch (name) { | ||
case 'authenticity': | ||
return authenticityAnalysis; | ||
case 'sentiment': | ||
return sentimentAnalysis; | ||
case 'toxicity': | ||
return toxicityAnalysis; | ||
default: | ||
return []; | ||
} | ||
export function getAnalysisValue(value: number, analysis: Analysis[]): Analysis { | ||
for (const item of analysis) { | ||
if (value > item.range[0] && value <= item.range[1]) { | ||
return item; | ||
} | ||
} | ||
export function getAnalysisValue(value: number, analysis: Analysis[]): Analysis { | ||
for (const item of analysis) { | ||
if (value > item.range[0] && value <= item.range[1]) { | ||
return item; | ||
} | ||
return analysis[analysis.length - 1]; | ||
} | ||
return analysis[analysis.length - 1]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters