Skip to content

Commit

Permalink
Merge pull request #635 from StampyAI/sundry-fixes
Browse files Browse the repository at this point in the history
Sundry fixes
  • Loading branch information
mruwnik committed May 24, 2024
2 parents 662a277 + 102db37 commit 5123318
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 429 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
| sed s/{CODA_TOKEN}/${{ secrets.CODA_TOKEN }}/ \
| sed s/{CODA_INCOMING_TOKEN}/${{ secrets.CODA_INCOMING_TOKEN }}/ \
| sed s/{CODA_WRITES_TOKEN}/${{ secrets.CODA_WRITES_TOKEN }}/ \
| sed s/{GOOGLE_ANALYTICS_ID}/${{ secrets.GOOGLE_ANALYTICS_ID }}/ \
| sed s/{MATOMO_DOMAIN}/${{ secrets.MATOMO_DOMAIN }}/ \
| sed s/{DISCORD_LOGGING_CHANNEL_ID}/${{ secrets.DISCORD_LOGGING_CHANNEL_ID }}/ \
| sed s/{DISCORD_LOGGING_TOKEN}/${{ secrets.DISCORD_LOGGING_TOKEN }}/ \
> wrangler.toml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
| sed s/{CODA_TOKEN}/${{ secrets.CODA_TOKEN }}/ \
| sed s/{CODA_INCOMING_TOKEN}/${{ secrets.CODA_INCOMING_TOKEN }}/ \
| sed s/{CODA_WRITES_TOKEN}/${{ secrets.CODA_WRITES_TOKEN }}/ \
| sed s/{GOOGLE_ANALYTICS_ID}/${{ secrets.GOOGLE_ANALYTICS_ID }}/ \
| sed s/{MATOMO_DOMAIN}/${{ secrets.MATOMO_DOMAIN }}/ \
| sed s/{DISCORD_LOGGING_CHANNEL_ID}/${{ secrets.DISCORD_LOGGING_CHANNEL_ID }}/ \
| sed s/{DISCORD_LOGGING_TOKEN}/${{ secrets.DISCORD_LOGGING_TOKEN }}/ \
> wrangler.toml
Expand Down
15 changes: 15 additions & 0 deletions app/components/Article/article.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,21 @@ article a.see-more.visible:after {
content: 'See less';
}

article .banner {
padding: var(--spacing-12) var(--spacing-24);
margin-bottom: var(--spacing-12);
}
article .banner h3 {
display: flex;
align-items: center;
}
article .banner h3 img {
width: 2em;
}
article .banner h3 .title {
padding-left: 10px;
}

@media only screen and (max-width: 780px) {
article {
max-width: 100%;
Expand Down
27 changes: 26 additions & 1 deletion app/components/Article/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import CopyIcon from '~/components/icons-generated/Copy'
import EditIcon from '~/components/icons-generated/Pencil'
import Button, {CompositeButton} from '~/components/Button'
import Feedback from '~/components/Feedback'
import type {Glossary, Question} from '~/server-utils/stampy'
import {tagUrl} from '~/routesMapper'
import type {Glossary, Question, Banner as BannerType} from '~/server-utils/stampy'
import Contents from './Contents'
import './article.css'

Expand Down Expand Up @@ -87,6 +87,30 @@ const ArticleMeta = ({question, className}: {question: Question; className?: str
)
}

const Banner = ({title, text, icon, backgroundColour, textColour}: BannerType) => {
return (
<div
key={title}
className="banner rounded"
style={{
backgroundColor: backgroundColour || 'inherit',
color: textColour || 'inherit',
}}
>
<h3>
<img src={icon?.url} alt={icon?.name} />
<span className="title">{title}</span>
</h3>
<div
className="banner-contents"
dangerouslySetInnerHTML={{
__html: text,
}}
></div>
</div>
)
}

const Tags = ({tags}: Question) => (
<div className="tags">
{tags?.map((tag) => (
Expand All @@ -108,6 +132,7 @@ export const Article = ({question, glossary, className}: ArticleProps) => {
return (
<article className={`${className} ${isLoading(question) ? 'loading' : ''}`}>
<h1 className="teal-500 padding-bottom-24">{title}</h1>
{question.banners?.map(Banner)}
<ArticleMeta question={question} className="padding-bottom-56" />

<Contents pageid={pageid} html={text || ''} glossary={glossary || {}} />
Expand Down
4 changes: 2 additions & 2 deletions app/components/Chatbot/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const SplashScreen = ({
<div className="padding-top-40">
<IconStampyLarge />
<div className="fcol-6 padding-bottom-40 padding-top-40">
n<h2 className="teal-500">Hi there, I'm Stampy.</h2>
<h2 className="teal-500">Hi there, I'm Stampy.</h2>
<h2>I can answer your questions about AI Safety</h2>
</div>
<Followups
Expand All @@ -190,7 +190,7 @@ export const Chatbot = ({question, questions, settings}: ChatbotProps) => {
const [followups, setFollowups] = useState<Followup[]>()

// FIXME: Generate session id
const [sessionId] = useState('asd')
const [sessionId] = useState(crypto.randomUUID())
const [history, setHistory] = useState([] as Entry[])
const [controller, setController] = useState(() => new AbortController())
const fetcher = useFetcher({key: 'followup-fetcher'})
Expand Down
292 changes: 0 additions & 292 deletions app/hooks/useQuestionStateInUrl.ts

This file was deleted.

Loading

0 comments on commit 5123318

Please sign in to comment.