-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(blog): v0.5 release post #2953
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2997b73
feat(blog): v0.5 post
waleedlatif1 3c4da85
improvement(blog): simplify title and remove code block header
waleedlatif1 a401ada
ack PR comments
waleedlatif1 30df76b
small styling improvements
waleedlatif1 821d45c
created system to create post-specific components
waleedlatif1 39ca976
updated componnet
waleedlatif1 e6df6a3
cache invalidation
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,27 @@ | ||
| 'use client' | ||
|
|
||
| import { useState } from 'react' | ||
| import { ArrowLeft, ChevronLeft } from 'lucide-react' | ||
| import Link from 'next/link' | ||
|
|
||
| export function BackLink() { | ||
| const [isHovered, setIsHovered] = useState(false) | ||
|
|
||
| return ( | ||
| <Link | ||
| href='/studio' | ||
| className='group flex items-center gap-1 text-gray-600 text-sm hover:text-gray-900' | ||
| onMouseEnter={() => setIsHovered(true)} | ||
| onMouseLeave={() => setIsHovered(false)} | ||
| > | ||
| <span className='group-hover:-translate-x-0.5 inline-flex transition-transform duration-200'> | ||
| {isHovered ? ( | ||
| <ArrowLeft className='h-4 w-4' aria-hidden='true' /> | ||
| ) : ( | ||
| <ChevronLeft className='h-4 w-4' aria-hidden='true' /> | ||
| )} | ||
| </span> | ||
| Back to Sim Studio | ||
| </Link> | ||
| ) | ||
| } |
This file contains hidden or 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 hidden or 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,65 @@ | ||
| 'use client' | ||
|
|
||
| import { useState } from 'react' | ||
| import { Share2 } from 'lucide-react' | ||
| import { Popover, PopoverContent, PopoverItem, PopoverTrigger } from '@/components/emcn' | ||
|
|
||
| interface ShareButtonProps { | ||
| url: string | ||
| title: string | ||
| } | ||
|
|
||
| export function ShareButton({ url, title }: ShareButtonProps) { | ||
| const [open, setOpen] = useState(false) | ||
| const [copied, setCopied] = useState(false) | ||
|
|
||
| const handleCopyLink = async () => { | ||
| try { | ||
| await navigator.clipboard.writeText(url) | ||
| setCopied(true) | ||
| setTimeout(() => { | ||
| setCopied(false) | ||
| setOpen(false) | ||
| }, 1000) | ||
| } catch { | ||
| setOpen(false) | ||
| } | ||
| } | ||
waleedlatif1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const handleShareTwitter = () => { | ||
| const tweetUrl = `https://twitter.com/intent/tweet?url=${encodeURIComponent(url)}&text=${encodeURIComponent(title)}` | ||
| window.open(tweetUrl, '_blank', 'noopener,noreferrer') | ||
| setOpen(false) | ||
| } | ||
|
|
||
| const handleShareLinkedIn = () => { | ||
| const linkedInUrl = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}` | ||
| window.open(linkedInUrl, '_blank', 'noopener,noreferrer') | ||
| setOpen(false) | ||
| } | ||
|
|
||
| return ( | ||
| <Popover | ||
| open={open} | ||
| onOpenChange={setOpen} | ||
| variant='secondary' | ||
| size='sm' | ||
| colorScheme='inverted' | ||
| > | ||
| <PopoverTrigger asChild> | ||
| <button | ||
| className='flex items-center gap-1.5 text-gray-600 text-sm hover:text-gray-900' | ||
| aria-label='Share this post' | ||
| > | ||
| <Share2 className='h-4 w-4' /> | ||
| <span>Share</span> | ||
| </button> | ||
| </PopoverTrigger> | ||
| <PopoverContent align='end' minWidth={140}> | ||
| <PopoverItem onClick={handleCopyLink}>{copied ? 'Copied!' : 'Copy link'}</PopoverItem> | ||
| <PopoverItem onClick={handleShareTwitter}>Share on X</PopoverItem> | ||
| <PopoverItem onClick={handleShareLinkedIn}>Share on LinkedIn</PopoverItem> | ||
| </PopoverContent> | ||
| </Popover> | ||
| ) | ||
| } | ||
This file contains hidden or 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 @@ | ||
| export { DiffControlsDemo } from './components/diff-controls-demo' |
111 changes: 111 additions & 0 deletions
111
apps/sim/content/blog/v0-5/components/diff-controls-demo.tsx
This file contains hidden or 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,111 @@ | ||
| 'use client' | ||
|
|
||
| import { useState } from 'react' | ||
|
|
||
| export function DiffControlsDemo() { | ||
| const [rejectHover, setRejectHover] = useState(false) | ||
| const [acceptHover, setAcceptHover] = useState(false) | ||
|
|
||
| return ( | ||
| <div style={{ display: 'flex', justifyContent: 'center', margin: '24px 0' }}> | ||
| <div | ||
| style={{ | ||
| position: 'relative', | ||
| display: 'flex', | ||
| height: '30px', | ||
| overflow: 'hidden', | ||
| borderRadius: '4px', | ||
| isolation: 'isolate', | ||
| }} | ||
| > | ||
| {/* Reject button */} | ||
| <button | ||
| onClick={() => {}} | ||
| onMouseEnter={() => setRejectHover(true)} | ||
| onMouseLeave={() => setRejectHover(false)} | ||
| title='Reject changes' | ||
| style={{ | ||
| position: 'relative', | ||
| display: 'flex', | ||
| height: '100%', | ||
| alignItems: 'center', | ||
| border: '1px solid #e0e0e0', | ||
| backgroundColor: rejectHover ? '#f0f0f0' : '#f5f5f5', | ||
| paddingRight: '20px', | ||
| paddingLeft: '12px', | ||
| fontWeight: 500, | ||
| fontSize: '13px', | ||
| color: rejectHover ? '#2d2d2d' : '#404040', | ||
| clipPath: 'polygon(0 0, calc(100% + 10px) 0, 100% 100%, 0 100%)', | ||
| borderRadius: '4px 0 0 4px', | ||
| cursor: 'default', | ||
| transition: 'color 150ms, background-color 150ms, border-color 150ms', | ||
| }} | ||
| > | ||
| Reject | ||
| </button> | ||
| {/* Slanted divider - split gray/green */} | ||
| <div | ||
| style={{ | ||
| pointerEvents: 'none', | ||
| position: 'absolute', | ||
| top: 0, | ||
| bottom: 0, | ||
| left: '66px', | ||
| width: '2px', | ||
| transform: 'skewX(-18.4deg)', | ||
| background: 'linear-gradient(to right, #e0e0e0 50%, #238458 50%)', | ||
| zIndex: 10, | ||
| }} | ||
| /> | ||
| {/* Accept button */} | ||
| <button | ||
| onClick={() => {}} | ||
| onMouseEnter={() => setAcceptHover(true)} | ||
| onMouseLeave={() => setAcceptHover(false)} | ||
| title='Accept changes (⇧⌘⏎)' | ||
| style={{ | ||
| position: 'relative', | ||
| display: 'flex', | ||
| height: '100%', | ||
| alignItems: 'center', | ||
| border: '1px solid rgba(0, 0, 0, 0.15)', | ||
| backgroundColor: '#32bd7e', | ||
| paddingRight: '12px', | ||
| paddingLeft: '20px', | ||
| fontWeight: 500, | ||
| fontSize: '13px', | ||
| color: '#ffffff', | ||
| clipPath: 'polygon(10px 0, 100% 0, 100% 100%, 0 100%)', | ||
| borderRadius: '0 4px 4px 0', | ||
| marginLeft: '-10px', | ||
| cursor: 'default', | ||
| filter: acceptHover ? 'brightness(1.1)' : undefined, | ||
| transition: 'background-color 150ms, border-color 150ms', | ||
| }} | ||
| > | ||
| Accept | ||
| <kbd | ||
| style={{ | ||
| marginLeft: '8px', | ||
| borderRadius: '4px', | ||
| border: '1px solid rgba(255, 255, 255, 0.2)', | ||
| backgroundColor: 'rgba(255, 255, 255, 0.1)', | ||
| paddingLeft: '6px', | ||
| paddingRight: '6px', | ||
| paddingTop: '2px', | ||
| paddingBottom: '2px', | ||
| fontWeight: 500, | ||
| fontFamily: | ||
| 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"', | ||
| fontSize: '10px', | ||
| color: '#ffffff', | ||
| }} | ||
| > | ||
| ⇧⌘<span style={{ display: 'inline-block', transform: 'translateY(-1px)' }}>⏎</span> | ||
| </kbd> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timeout causes unexpected popover auto-close on reopen
Low Severity
The
setTimeoutinhandleCopyLinkis never cleared. If a user copies a link and then manually closes the popover before the 1-second timeout fires, reopening the popover within that window causes it to unexpectedly close when the stale timeout executessetOpen(false). Thecopiedstate also persists across close/reopen, so the user briefly sees "Copied!" before the timeout resets everything.