[verb た-form] + ら、[verb (dictionary form)] + ところだった [verb た-form] + ら、[na-adj] + な + ところだった
たら~ところだった says what would have happened if things had gone differently, and it didn't happen: "if X had happened, I would have Y". The condition is a たら clause, often きごう〜ていたら or きごう〜なかったら, and the verb before ところだった is in the dictionary form.
Most of the time the outcome is something bad that was avoided, and the sentence carries relief.
The past belongs on だった at the end. The verb in front stays in the dictionary form, because the thing never happened. きごう〜たところだった is a different pattern meaning "had just done".
With a potential verb and のに, the sentence regrets something good that almost happened.
These go beyond a close call in the past.
The たら clause can drop out. もうすこし少しで or あやうく危うく then says how close it came.
With いまごろ今ごろ and a ている verb, the sentence says where things would stand now, and the ending stays ところだ.