Skip to content
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

Dismiss tour from overlay #2525

Merged
merged 14 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions server/app/onboarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ func (a *App) createWelcomeBoard(userID, workspaceID string) (string, error) {

blocks = model.GenerateBlockIDs(blocks, a.logger)

if errUpdateFileIDs := a.CopyCardFiles(onboardingBoardID, workspaceID, blocks); errUpdateFileIDs != nil {
return "", errUpdateFileIDs
}

// we're copying from a global template, so we need to set the
// `isTemplate` flag to false on the board
var welcomeBoardID string
Expand Down
4 changes: 4 additions & 0 deletions server/app/onboarding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func TestPrepareOnboardingTour(t *testing.T) {
"user_id_1",
).Return(nil)

th.Store.EXPECT().GetBlock(gomock.Any(), "block_id_1").Return(&welcomeBoard, nil)

th.Store.EXPECT().CreatePrivateWorkspace("user_id_1").Return("workspace_id_1", nil)

userPropPatch := model.UserPropPatch{
Expand Down Expand Up @@ -86,6 +88,8 @@ func TestCreateWelcomeBoard(t *testing.T) {
"user_id_1",
).Return(nil)

th.Store.EXPECT().GetBlock(gomock.Any(), "block_id_1").Return(&welcomeBoard, nil)

boardID, err := th.App.createWelcomeBoard("user_id_1", "workspace_id_1")
assert.Nil(t, err)
assert.NotEmpty(t, boardID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ describe('components/boardTemplateSelector/boardTemplateSelector', () => {
beforeEach(() => {
jest.clearAllMocks()
const state = {
users: {
me: {
id: 'user_id_1',
},
},
workspace: {
userWorkspaces: new Array<UserWorkspace>(workspace1),
current: workspace1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ import {fetchGlobalTemplates, getGlobalTemplates} from '../../store/globalTempla
import {useAppDispatch, useAppSelector} from '../../store/hooks'
import TelemetryClient, {TelemetryActions, TelemetryCategory} from '../../telemetry/telemetryClient'

import './boardTemplateSelector.scss'
import {OnboardingBoardTitle} from '../cardDetail/cardDetail'
import {IUser, UserConfigPatch, UserPropPrefix} from '../../user'
import {getMe, patchProps} from '../../store/users'
import {BaseTourSteps, TOUR_BASE} from '../onboardingTour'

import BoardTemplateSelectorPreview from './boardTemplateSelectorPreview'
import BoardTemplateSelectorItem from './boardTemplateSelectorItem'

import './boardTemplateSelector.scss'

type Props = {
title?: React.ReactNode
description?: React.ReactNode
Expand All @@ -35,6 +39,7 @@ const BoardTemplateSelector = (props: Props) => {
const intl = useIntl()
const history = useHistory()
const match = useRouteMatch<{boardId: string, viewId?: string}>()
const me = useAppSelector<IUser|null>(getMe)

const showBoard = useCallback(async (boardId) => {
const params = {...match.params, boardId: boardId || ''}
Expand Down Expand Up @@ -69,6 +74,33 @@ const BoardTemplateSelector = (props: Props) => {
const templates = useMemo(() => Object.values(unsortedTemplates).sort((a: Board, b: Board) => a.createAt - b.createAt), [unsortedTemplates])
const allTemplates = globalTemplates.concat(templates)

const resetTour = async () => {
TelemetryClient.trackEvent(TelemetryCategory, TelemetryActions.StartTour)

if (!me) {
return
}

const patch: UserConfigPatch = {
updatedFields: {
[UserPropPrefix + 'onboardingTourStep']: BaseTourSteps.OPEN_A_CARD.toString(),
[UserPropPrefix + 'tourCategory']: TOUR_BASE,
},
}

const patchedProps = await octoClient.patchUserConfig(me.id, patch)
if (patchedProps) {
await dispatch(patchProps(patchedProps))
}
}

const handleUseTemplate = async () => {
await mutator.addBoardFromTemplate(intl, showBoard, () => showBoard(currentBoard.id), activeTemplate.id, activeTemplate.workspaceId === '0')
if (activeTemplate.title === OnboardingBoardTitle) {
resetTour()
}
}

const [activeTemplate, setActiveTemplate] = useState<Board>(allTemplates[0])

useEffect(() => {
Expand Down Expand Up @@ -142,7 +174,7 @@ const BoardTemplateSelector = (props: Props) => {
<Button
filled={true}
size={'medium'}
onClick={() => mutator.addBoardFromTemplate(intl, showBoard, () => showBoard(currentBoard.id), activeTemplate.id, activeTemplate.workspaceId === '0')}
onClick={handleUseTemplate}
>
<FormattedMessage
id='BoardTemplateSelector.use-this-template'
Expand Down
8 changes: 8 additions & 0 deletions webapp/src/components/cardDetail/comment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@
width: 100%;
padding-left: 32px;

a {
color: rgb(var(--link-color-rgb));

&:hover {
text-decoration: underline;
}
}

p {
&:first-child {
margin-top: 0;
Expand Down
6 changes: 5 additions & 1 deletion webapp/src/components/topBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
font-size: 14px;
line-height: 14px;
padding: 2px 10px;
color: rgba(var(--center-channel-color-rgb), 0.7);
color: rgba(var(--center-channel-color-rgb), 0.72);

&:hover {
color: rgba(var(--center-channel-color-rgb), 1);
}
}

.HelpIcon {
Expand Down
8 changes: 0 additions & 8 deletions webapp/src/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ html {
a {
text-decoration: none;
color: var(--link-color-rgb);

&:hover {
background-color: rgba(192, 192, 255, 0.2);
}
}

hr {
Expand All @@ -72,10 +68,6 @@ html {
}

#focalboard-app {
a:visited {
color: var(--link-visited-color-rgb);
}

button {
&.style--none {
background: transparent;
Expand Down